Skip to content

Commit 7842171

Browse files
committed
Skip Instances with --collect-only
1 parent 9140d4f commit 7842171

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/_pytest/terminal.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -617,8 +617,8 @@ def _printcollecteditems(self, items):
617617
stack.pop()
618618
for col in needed_collectors[len(stack) :]:
619619
stack.append(col)
620-
# if col.name == "()":
621-
# continue
620+
if col.name == "()": # Skip Instances.
621+
continue
622622
indent = (len(stack) - 1) * " "
623623
self._tw.line("%s%s" % (indent, col))
624624

testing/python/collect.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,9 +1408,7 @@ def test_hello(self):
14081408
"""
14091409
)
14101410
result = testdir.runpytest("--collect-only")
1411-
result.stdout.fnmatch_lines(
1412-
["*MyClass*", "*MyInstance*", "*MyFunction*test_hello*"]
1413-
)
1411+
result.stdout.fnmatch_lines(["*MyClass*", "*MyFunction*test_hello*"])
14141412

14151413

14161414
def test_unorderable_types(testdir):

0 commit comments

Comments
 (0)