Completed
Push — develop ( 1118ed...cc51a4 )
by Jace
02:37
created

TestFindRoot   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 14
Duplicated Lines 0 %
Metric Value
dl 0
loc 14
rs 10
wmc 8

4 Methods

Rating   Name   Duplication   Size   Complexity  
A test_missing() 0 2 2
A test_none() 0 2 2
A test_current() 0 2 2
A test_specified() 0 3 2
1
# pylint: disable=no-self-use
2
3
import os
4
5
from .conftest import ROOT, FILES
6
7
from gitman.commands import _find_root, install, update, display, delete
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