Completed
Pull Request — develop (#141)
by Jace
02:42
created

TestCommands.test_commands_can_be_run_without_project()   B

Complexity

Conditions 5

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 5
c 1
b 0
f 0
dl 0
loc 7
rs 8.5454
1
# pylint: disable=no-self-use
2
3
import os
4
5
from gitman.commands import _find_root, install, update, display, delete
6
7
from .conftest import ROOT, FILES
8
9
PROJECT_ROOT = os.path.dirname(os.path.dirname(ROOT))
10
PROJECT_PARENT = os.path.dirname(PROJECT_ROOT)
11
12
13
class TestCommands:
14
15
    def test_commands_can_be_run_without_project(self, tmpdir):
16
        tmpdir.chdir()
17
18
        assert not install()
19
        assert not update()
20
        assert not display()
21
        assert not delete()
22
23
24
class TestFindRoot:
25
26
    def test_specified(self):
27
        os.chdir(PROJECT_PARENT)
28
        assert FILES == _find_root(FILES)
29
30
    def test_none(self):
31
        assert PROJECT_ROOT == _find_root(None, cwd=ROOT)
32
33
    def test_current(self):
34
        assert PROJECT_ROOT == _find_root(PROJECT_ROOT, cwd=ROOT)
35
36
    def test_missing(self):
37
        assert PROJECT_PARENT == _find_root(None, cwd=PROJECT_PARENT)
38