Skip to content

Commit

Permalink
Skip Instances with --collect-only
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed committed Nov 10, 2018
1 parent 9140d4f commit 7842171
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/_pytest/terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,8 +617,8 @@ def _printcollecteditems(self, items):
stack.pop()
for col in needed_collectors[len(stack) :]:
stack.append(col)
# if col.name == "()":
# continue
if col.name == "()": # Skip Instances.
continue
indent = (len(stack) - 1) * " "
self._tw.line("%s%s" % (indent, col))

Expand Down
4 changes: 1 addition & 3 deletions testing/python/collect.py
Original file line number Diff line number Diff line change
Expand Up @@ -1408,9 +1408,7 @@ def test_hello(self):
"""
)
result = testdir.runpytest("--collect-only")
result.stdout.fnmatch_lines(
["*MyClass*", "*MyInstance*", "*MyFunction*test_hello*"]
)
result.stdout.fnmatch_lines(["*MyClass*", "*MyFunction*test_hello*"])


def test_unorderable_types(testdir):
Expand Down

0 comments on commit 7842171

Please sign in to comment.