Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bd91b93

Browse files
committed
Remove pytest collection filter.
It's really only needed to get the pep8 options.
1 parent ab99e65 commit bd91b93

File tree

3 files changed

+5
-61
lines changed

3 files changed

+5
-61
lines changed

conftest.py

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -9,68 +9,11 @@
99
import matplotlib
1010
matplotlib.use('agg')
1111

12-
from matplotlib import default_test_modules
13-
14-
15-
IGNORED_TESTS = {
16-
'matplotlib': [],
17-
}
18-
19-
20-
def blacklist_check(path):
21-
"""Check if test is blacklisted and should be ignored"""
22-
head, tests_dir = os.path.split(path.dirname)
23-
if tests_dir != 'tests':
24-
return True
25-
head, top_module = os.path.split(head)
26-
return path.purebasename in IGNORED_TESTS.get(top_module, [])
27-
28-
29-
def whitelist_check(path):
30-
"""Check if test is not whitelisted and should be ignored"""
31-
left = path.dirname
32-
last_left = None
33-
module_path = path.purebasename
34-
while len(left) and left != last_left:
35-
last_left = left
36-
left, tail = os.path.split(left)
37-
module_path = '.'.join([tail, module_path])
38-
if module_path in default_test_modules:
39-
return False
40-
return True
41-
42-
43-
COLLECT_FILTERS = {
44-
'none': lambda _: False,
45-
'blacklist': blacklist_check,
46-
'whitelist': whitelist_check,
47-
}
48-
49-
50-
def pytest_addoption(parser):
51-
group = parser.getgroup("matplotlib", "matplotlib custom options")
52-
53-
group.addoption('--collect-filter', action='store',
54-
choices=COLLECT_FILTERS, default='blacklist',
55-
help='filter tests during collection phase')
56-
57-
group.addoption('--no-pep8', action='store_true',
58-
help='skip PEP8 compliance tests')
59-
6012

6113
def pytest_configure(config):
6214
matplotlib._called_from_pytest = True
6315
matplotlib._init_tests()
6416

65-
if config.getoption('--no-pep8'):
66-
IGNORED_TESTS['matplotlib'] += 'test_coding_standards'
67-
6817

6918
def pytest_unconfigure(config):
7019
matplotlib._called_from_pytest = False
71-
72-
73-
def pytest_ignore_collect(path, config):
74-
if path.ext == '.py':
75-
collect_filter = config.getoption('--collect-filter')
76-
return COLLECT_FILTERS[collect_filter](path)

pytest.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[pytest]
2-
norecursedirs = .git build ci dist extern release tools unit venv
2+
norecursedirs = .git build ci dist doc extern lib/mpl_examples release tools unit venv
3+
python_files = test_*.py
34
pep8ignore =
45
* E111 E114 E115 E116 E121 E122 E123 E124 E125 E126 E127 E128 E129 E131 E226 E240 E241 E242 E243 E244 E245 E246 E247 E248 E249 E265 E266 E704 W503
56

tests.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222

2323
# The warnings need to be before any of matplotlib imports, but after
2424
# setuptools (if present) which has syntax error with the warnings enabled.
25-
# Filtering by module does not work as this will be raised by Python itself.
25+
# Filtering by module does not work as this will be raised by Python itself
2626
# so `module=matplotlib.*` is out of questions.
2727

2828
import warnings
2929

30-
# Python 3.6 deprecate invalid character-pairs \A, \* ... in non raw-strings
31-
# and other things. Let's not re-introduce them
30+
# Python 3.6 deprecate invalid character-pairs \A, \* ... in non
31+
# raw-strings and other things. Let's not re-introduce them
3232
warnings.filterwarnings('error', '.*invalid escape sequence.*',
3333
category=DeprecationWarning)
3434
warnings.filterwarnings(

0 commit comments

Comments
 (0)