Skip to content

Commit f74433a

Browse files
committed
Skip tests generated by plugins (like pep8) for discovery command.
To do not fail on discovery command and do not track their results.
1 parent acd7a3d commit f74433a

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

pythonFiles/testing_tools/adapter/pytest/_discovery.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ def pytest_collection_modifyitems(self, session, config, items):
7878
self._tests.reset()
7979
for item in items:
8080
test, parents = self.parse_item(item)
81-
self._tests.add_test(test, parents)
81+
if test is not None:
82+
self._tests.add_test(test, parents)
8283

8384
# This hook is not specified in the docs, so we also provide
8485
# the "modifyitems" hook just in case.
@@ -92,4 +93,5 @@ def pytest_collection_finish(self, session):
9293
self._tests.reset()
9394
for item in items:
9495
test, parents = self.parse_item(item)
95-
self._tests.add_test(test, parents)
96+
if test is not None:
97+
self._tests.add_test(test, parents)

pythonFiles/testing_tools/adapter/pytest/_pytest_item.py

+3
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ def parse_item(item, #*,
152152
"""
153153
#_debug_item(item, showsummary=True)
154154
kind, _ = _get_item_kind(item)
155+
# Skip plugin generated tests
156+
if kind is None:
157+
return None, None
155158
(nodeid, parents, fileid, testfunc, parameterized
156159
) = _parse_node_id(item.nodeid, kind)
157160
# Note: testfunc does not necessarily match item.function.__name__.

0 commit comments

Comments
 (0)