Completed
Push — develop ( b34257...4c6de9 )
by Jace
12s
created

it_misses_with_no_data()   A

Complexity

Conditions 1

Size

Total Lines 2

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 2
rs 10
1
# pylint: disable=missing-docstring,unused-variable,unused-argument,expression-not-assigned,singleton-comparison
0 ignored issues
show
introduced by
Bad option value 'singleton-comparison'
Loading history...
2
3
import os
4
5
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...
6
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...
7
8
from coveragespace.cache import Cache
9
10
11
def describe_cache():
12
13
    @pytest.fixture
14
    def cache():
15
        return Cache()
16
17
    @pytest.fixture
18
    def cache_empty(cache):
19
        # pylint: disable=protected-access
20
        cache._data.clear()
21
        return cache
22
23
    @pytest.fixture
24
    def cache_missing(cache_empty):
25
        try:
26
            os.remove(Cache.PATH)
27
        except OSError:
28
            pass
29
        return cache_empty
30
31
    @pytest.fixture
32
    def cache_corrupt(cache):
33
        # pylint: disable=protected-access
34
        cache._data = "corrupt"
35
        cache._store()
36
        return cache
37
38
    def describe_init():
39
40
        def it_loads_previous_results(cache_empty):
41
            cache_empty.set("url", {}, "previous")
42
43
            cache = Cache()
44
            expect(cache.get("url", {})) == "previous"
45
46
        def it_handles_missing_cache_files(cache_missing):
47
            expect(Cache().get("url", {})) == None
48
49
        def it_handles_corrupt_cache_files(cache_corrupt):
50
            expect(Cache().get("url", {})) == None
51
52
    def describe_get():
53
54
        def it_hits_with_existing_data(cache_empty):
55
            cache = cache_empty
56
            cache.set("url", {}, "existing")
57
58
            expect(cache.get("url", {})) == "existing"
59
60
        def it_misses_with_no_data(cache_empty):
61
            expect(cache_empty.get("url", {})) == None
62