Completed
Push — develop ( 644415...bc32de )
by Jace
01:46
created

env()   A

Complexity

Conditions 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 1
dl 0
loc 4
rs 10
1
# pylint: disable=redefined-outer-name,unused-variable,expression-not-assigned
2
3
from __future__ import unicode_literals
4
5
import os
6
import sys
7
8
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...
9
import scripttest
0 ignored issues
show
Configuration introduced by
The import scripttest 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...
10
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...
11
import six
12
13
14
@pytest.fixture
15
def env(tmpdir):
16
    path = str(tmpdir.join('test'))
17
    return scripttest.TestFileEnvironment(path)
18
19
20
def cli(env, *args):
21
    prog = os.path.join(os.path.dirname(sys.executable), 'coverage.space')
22
    cmd = env.run(prog, *args, expect_error=True)
23
    six.print_(cmd)
24
    return cmd
25
26
27
def describe_cli():
28
29
    def it_fails_when_missing_arguments(env):
30
        cmd = cli(env)
31
32
        expect(cmd.returncode) == 1
33
        expect(cmd.stderr).contains("Usage:")
34
35
    def it_can_update_metrics(env):
36
        cmd = cli(env, 'foo/bar', 'unit', '100')
37
38
        expect(cmd.returncode) == 0
39
        expect(cmd.stderr) == ""
40
        expect(cmd.stdout) == ""
41
42
    def it_indicates_when_metrics_decrease(env):
43
        cmd = cli(env, 'foo/bar', 'unit', '0')
44
45
        expect(cmd.returncode) == 0
46
        expect(cmd.stderr) == ""
47
        expect(cmd.stdout).contains("coverage decreased")
48
49
    def it_fails_when_metrics_decrease_if_requested(env):
50
        cmd = cli(env, 'foo/bar', 'unit', '0', '--exit-code')
51
52
        expect(cmd.returncode) == 1
53
        expect(cmd.stderr) == ""
54
        expect(cmd.stdout).contains("coverage decreased")
55