Completed
Push — develop ( d8b783...f586da )
by Jace
03:43
created

coveragespace/tests/test_plugins.py (3 issues)

1
# pylint: disable=missing-docstring,unused-variable,unused-argument,expression-not-assigned
2
from mock import patch, Mock
0 ignored issues
show
The import mock 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...
3
4
import pytest
0 ignored issues
show
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...
5
from expecter import expect
0 ignored issues
show
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...
6
7
from coveragespace.plugins import get_coverage
8
9
10
class MockCoverage(Mock):
11
12
    @staticmethod
13
    def report(*args, **kwargs):
14
        return 42.456
15
16
17
def describe_get_coverage():
18
19
    @pytest.fixture
20
    def coveragepy_data(tmpdir):
21
        cwd = tmpdir.chdir()
22
        with open("foobar.py", 'w') as stream:
23
            pass
24
        with open(".coverage", 'w') as stream:
25
            stream.write("""
26
            !coverage.py: This is a private format, don\'t read it directly!
27
            {"arcs":{"foobar.py": [[-1, 3]]}}
28
            """.strip())
29
30
    @patch('coverage.Coverage', MockCoverage)
31
    def it_supports_coveragepy(coveragepy_data):
32
        expect(get_coverage()) == 42.5
33