Skip Instances with --collect-only

This commit is contained in:
Daniel Hahler 2018-11-09 11:32:44 +01:00
parent 87254ca593
commit f551cb9677
3 changed files with 5 additions and 5 deletions

View File

@ -14,3 +14,5 @@ it was not really possible to detect when the functionality was being used expli
The extra ``::()`` might have been removed in some places internally already,
which then led to confusion in places where it was expected, e.g. with
``--deselect`` (`#4127 <https://github.com/pytest-dev/pytest/issues/4127>`_).
Test class instances are also not listed with ``--collect-only`` anymore.

View File

@ -617,8 +617,8 @@ class TerminalReporter(object):
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))

View File

@ -1408,9 +1408,7 @@ def test_customize_through_attributes(testdir):
"""
)
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):