Completed
Pull Request — develop (#112)
by Jace
15:32 queued 05:31
created

tests.it_can_print_a_depenendcy_path()   A

Complexity

Conditions 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 1
dl 0
loc 5
rs 9.4285
1
# pylint: disable=unused-variable,redefined-outer-name,expression-not-assigned
2
3
import os
4
from unittest.mock import patch, call
5
6
import pytest
7
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...
8
9
from gitman import cli
10
11
12
@pytest.fixture
13
def config(tmpdir):
14
    tmpdir.chdir()
15
    path = str(tmpdir.join("gdm.yml"))
16
    open(path, 'w').close()
17
    return path
18
19
20
@pytest.fixture
21
def location(tmpdir):
22
    tmpdir.chdir()
23
    path = str(tmpdir.join("gdm.yml"))
24
    with open(path, 'w') as outfile:
25
        outfile.write("location: foo")
26
    return str(tmpdir.join("foo"))
27
28
29
def describe_show():
30
31
    @patch('gitman.common.show')
32
    def it_prints_location_by_default(show, location):
33
        cli.main(['show'])
34
35
        expect(show.mock_calls) == [call(location)]
36
37
    @patch('gitman.common.show')
38
    def it_can_print_a_depenendcy_path(show, location):
39
        cli.main(['show', 'bar'])
40
41
        expect(show.mock_calls) == [call(os.path.join(location, "bar"))]
42
43
44
def describe_edit():
45
46
    @patch('gitman.system.launch')
47
    def it_launches_the_config(launch, config):
48
        cli.main(['edit'])
49
50
        expect(launch.mock_calls) == [call(config), call().__bool__()]
51
52
    def it_exits_when_no_config_found(tmpdir):
53
        tmpdir.chdir()
54
55
        with expect.raises(SystemExit):
56
            cli.main(['edit'])
57