Skip to content

Commit

Permalink
Skip tests generated by plugins (like pep8) for discovery command.
Browse files Browse the repository at this point in the history
To do not fail on discovery command and do not track their results.
  • Loading branch information
Pavel Zaikin committed Oct 28, 2019
1 parent acd7a3d commit f74433a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pythonFiles/testing_tools/adapter/pytest/_discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ def pytest_collection_modifyitems(self, session, config, items):
self._tests.reset()
for item in items:
test, parents = self.parse_item(item)
self._tests.add_test(test, parents)
if test is not None:
self._tests.add_test(test, parents)

# This hook is not specified in the docs, so we also provide
# the "modifyitems" hook just in case.
Expand All @@ -92,4 +93,5 @@ def pytest_collection_finish(self, session):
self._tests.reset()
for item in items:
test, parents = self.parse_item(item)
self._tests.add_test(test, parents)
if test is not None:
self._tests.add_test(test, parents)
3 changes: 3 additions & 0 deletions pythonFiles/testing_tools/adapter/pytest/_pytest_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ def parse_item(item, #*,
"""
#_debug_item(item, showsummary=True)
kind, _ = _get_item_kind(item)
# Skip plugin generated tests
if kind is None:
return None, None
(nodeid, parents, fileid, testfunc, parameterized
) = _parse_node_id(item.nodeid, kind)
# Note: testfunc does not necessarily match item.function.__name__.
Expand Down

0 comments on commit f74433a

Please sign in to comment.