Skip to content

Commit 8b24a66

Browse files
committed
Set TestData.__test__ to False to avoid pytest discovery
As the class name starts with "Test", pytest interprets it as a test case, but it is not one. Further, due to its `__init__` method, pytest emits the following warning: .../pip/tests/lib/__init__.py:141: PytestCollectionWarning: cannot collect test class 'TestData' because it has a __init__ constructor For additional information on pytest discovery, see: https://docs.pytest.org/en/latest/example/pythoncollection.html
1 parent c928d89 commit 8b24a66

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

news/a9b36e28-beec-4a37-97e1-6dc02ff1eb2d.trivial.rst

Whitespace-only changes.

tests/lib/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ class TestData:
150150
data into a directory and operating on the copied data.
151151
"""
152152

153+
__test__ = False
154+
153155
def __init__(self, root, source=None):
154156
self.source = source or DATA_DIR
155157
self.root = Path(root).resolve()

0 commit comments

Comments
 (0)