-
-
Notifications
You must be signed in to change notification settings - Fork 93
Expand file tree
/
Copy pathconftest.py
More file actions
29 lines (23 loc) · 789 Bytes
/
conftest.py
File metadata and controls
29 lines (23 loc) · 789 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import sys
collect_ignore = [
# this module fails mypy tests because 'setup.py' matches './setup.py'
'tests/data/sources/example/setup.py',
]
def pytest_configure():
remove_importlib_metadata()
def remove_importlib_metadata():
"""
Ensure importlib_metadata is not imported yet.
Because pytest or other modules might import
importlib_metadata, the coverage reports are broken (#322).
Work around the issue by undoing the changes made by a
previous import of importlib_metadata (if any).
"""
sys.meta_path[:] = [
item
for item in sys.meta_path
if item.__class__.__name__ != 'MetadataPathFinder'
]
for mod in list(sys.modules):
if mod.startswith('importlib_metadata'):
del sys.modules[mod]