We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ea72278 commit f794723Copy full SHA for f794723
conftest.py
@@ -1,4 +1,25 @@
1
+import sys
2
+
3
4
collect_ignore = [
5
# this module fails mypy tests because 'setup.py' matches './setup.py'
6
'prepare/example/setup.py',
7
]
8
9
10
+def pytest_configure():
11
+ remove_importlib_metadata()
12
13
14
+def remove_importlib_metadata():
15
+ """
16
+ Because pytest imports importlib_metadata, the coverage
17
+ reports are broken (#322). So work around the issue by
18
+ undoing the changes made by pytest's import of
19
+ importlib_metadata (if any).
20
21
+ if sys.meta_path[-1].__class__.__name__ == 'MetadataPathFinder':
22
+ del sys.meta_path[-1]
23
+ for mod in list(sys.modules):
24
+ if mod.startswith('importlib_metadata'):
25
+ del sys.modules[mod]
0 commit comments