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

TestCommands   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 8
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A test_commands_can_be_run_without_project() 0 6 1
1
# pylint: disable=no-self-use,expression-not-assigned,singleton-comparison
0 ignored issues
show
introduced by
Bad option value 'singleton-comparison'
Loading history...
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
20
        expect(update()) == False
21
        expect(display()) == False
22
        expect(delete()) == False
23
24
25
class TestFindRoot:
26
27
    def test_specified(self):
28
        os.chdir(str(PROJECT_PARENT))
29
        expect(_find_root(FILES)) == FILES
30
31
    def test_none(self):
32
        expect(_find_root(None, cwd=ROOT)) == PROJECT_ROOT
33
34
    def test_current(self):
35
        expect(_find_root(PROJECT_ROOT, cwd=ROOT)) == PROJECT_ROOT
36
37
    def test_missing(self):
38
        expect(_find_root(None, cwd=PROJECT_PARENT)) == PROJECT_PARENT
39