Completed
Push — develop ( 76c4d9...d85607 )
by Jace
01:59
created

with_a_filled_section()   A

Complexity

Conditions 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
dl 0
loc 9
rs 9.6666
1
# pylint: disable=unused-variable,unused-argument,expression-not-assigned
2
3
import pytest
0 ignored issues
show
Configuration introduced by
The import pytest 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...
4
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...
5
6
from verchew.script import find_config, parse_config
7
8
9
def describe_find_config():
10
11
    @pytest.fixture
12
    def config(tmpdir):
13
        tmpdir.chdir()
14
        path = tmpdir.join("foo.bar")
15
        path.write("")
16
        return path
17
18
    def when_missing(config):
19
        with expect.raises(RuntimeError):
20
            find_config()
21
22
    def when_found(config):
23
        path = find_config(config_filenames=["foo.bar"])
24
25
        expect(path) == config
26
27
28
def describe_parse_config():
29
30
    @pytest.fixture
31
    def config(tmpdir):
32
        tmpdir.chdir()
33
        path = tmpdir.join("verchew.ini")
34
        path.write("")
35
        return path
36
37
    def with_no_content(config):
38
        config.write("")
39
40
        expect(parse_config(str(config))) == {}
41
42
    def with_an_empty_section(config):
43
        config.write("""
44
        [Foobar]
45
        """)
46
47
        expect(parse_config(str(config))) == {
48
            'Foobar': {},
49
        }
50
51
    def with_a_filled_section(config):
52
        config.write("""
53
        [Foobar]
54
55
        cli = foobar
56
        version = v1.2.3
57
        """)
58
59
        expect(parse_config(str(config))) == {
60
            'Foobar': {
61
                'cli': 'foobar',
62
                'version': 'v1.2.3',
63
            },
64
        }
65