GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Skip tests generated by pytest plugins during discovery. (#8242) · sbdchd/vscode-python@355a325

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • news/2 Fixes
    • 7287.md
  • pythonFiles/testing_tools/adapter/pytest
    • _discovery.py
    • _pytest_item.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎news/2 Fixes/7287.md‎

Copy file name to clipboard
+2Lines changed: 2 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
During test discovery, ignore tests generated by pytest plugins (like pep8).
2+
Tests like that were causing discovery to fail.
Collapse file

‎pythonFiles/testing_tools/adapter/pytest/_discovery.py‎

Copy file name to clipboardExpand all lines: pythonFiles/testing_tools/adapter/pytest/_discovery.py
+4-2Lines changed: 4 additions & 2 deletions
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)
Collapse file

‎pythonFiles/testing_tools/adapter/pytest/_pytest_item.py‎

Copy file name to clipboardExpand all lines: pythonFiles/testing_tools/adapter/pytest/_pytest_item.py
+3Lines changed: 3 additions & 0 deletions
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 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.