Completed
Pull Request — develop (#117)
by Jace
06:37
created

test_commands_can_be_run_without_project()   A

Complexity

Conditions 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 1
dl 0
loc 6
rs 9.4285
1
# pylint: disable=no-self-use
2
3
import os
4
5
from expecter import expect
0 ignored issues
show
Configuration introduced by
The import expecter could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
6
7
from .conftest import ROOT, FILES
8
9
from gitman.commands import _find_root, install, update, display, delete
10
11
PROJECT_ROOT = ROOT.parents[1]
12
PROJECT_PARENT = PROJECT_ROOT.parent
13
14
15
class TestCommands:
16
17
    def test_commands_can_be_run_without_project(self, tmpdir):
18
        tmpdir.chdir()
19
        expect(install()) == False
0 ignored issues
show
Unused Code Bug introduced by
The expression expect(install()) == False does not seem to have sideeffects and its result is not used.

If a expression has no sideeffects (any lasting effect after it has been called) and its return value is not used, this usually means that this code can be removed or that an assignment is missing.

Loading history...
20
        expect(update()) == False
0 ignored issues
show
Unused Code Bug introduced by
The expression expect(update()) == False does not seem to have sideeffects and its result is not used.

If a expression has no sideeffects (any lasting effect after it has been called) and its return value is not used, this usually means that this code can be removed or that an assignment is missing.

Loading history...
21
        expect(display()) == False
0 ignored issues
show
Unused Code Bug introduced by
The expression expect(display()) == False does not seem to have sideeffects and its result is not used.

If a expression has no sideeffects (any lasting effect after it has been called) and its return value is not used, this usually means that this code can be removed or that an assignment is missing.

Loading history...
22
        expect(delete()) == False
0 ignored issues
show
Unused Code Bug introduced by
The expression expect(delete()) == False does not seem to have sideeffects and its result is not used.

If a expression has no sideeffects (any lasting effect after it has been called) and its return value is not used, this usually means that this code can be removed or that an assignment is missing.

Loading history...
23
24
25
class TestFindRoot:
26
27
    def test_specified(self):
28
        os.chdir(str(PROJECT_PARENT))
29
        expect(_find_root(FILES)) == FILES
0 ignored issues
show
Unused Code Bug introduced by
The expression expect(_find_root(FILES)) == FILES does not seem to have sideeffects and its result is not used.

If a expression has no sideeffects (any lasting effect after it has been called) and its return value is not used, this usually means that this code can be removed or that an assignment is missing.

Loading history...
30
31
    def test_none(self):
32
        expect(_find_root(None, cwd=ROOT)) == PROJECT_ROOT
0 ignored issues
show
Unused Code Bug introduced by
The expression expect(_find_root(None, cwd=ROOT)) == PROJECT_ROOT does not seem to have sideeffects and its result is not used.

If a expression has no sideeffects (any lasting effect after it has been called) and its return value is not used, this usually means that this code can be removed or that an assignment is missing.

Loading history...
33
34
    def test_current(self):
35
        expect(_find_root(PROJECT_ROOT, cwd=ROOT)) == PROJECT_ROOT
0 ignored issues
show
Unused Code Bug introduced by
The expression expect(_find_root(PROJEC...=ROOT)) == PROJECT_ROOT does not seem to have sideeffects and its result is not used.

If a expression has no sideeffects (any lasting effect after it has been called) and its return value is not used, this usually means that this code can be removed or that an assignment is missing.

Loading history...
36
37
    def test_missing(self):
38
        expect(_find_root(None, cwd=PROJECT_PARENT)) == PROJECT_PARENT
0 ignored issues
show
Unused Code Bug introduced by
The expression expect(_find_root(None, ...ENT)) == PROJECT_PARENT does not seem to have sideeffects and its result is not used.

If a expression has no sideeffects (any lasting effect after it has been called) and its return value is not used, this usually means that this code can be removed or that an assignment is missing.

Loading history...
39