Skip Instances with --collect-only
This commit is contained in:
parent
87254ca593
commit
f551cb9677
|
@ -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,
|
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
|
which then led to confusion in places where it was expected, e.g. with
|
||||||
``--deselect`` (`#4127 <https://github.com/pytest-dev/pytest/issues/4127>`_).
|
``--deselect`` (`#4127 <https://github.com/pytest-dev/pytest/issues/4127>`_).
|
||||||
|
|
||||||
|
Test class instances are also not listed with ``--collect-only`` anymore.
|
||||||
|
|
|
@ -617,8 +617,8 @@ class TerminalReporter(object):
|
||||||
stack.pop()
|
stack.pop()
|
||||||
for col in needed_collectors[len(stack) :]:
|
for col in needed_collectors[len(stack) :]:
|
||||||
stack.append(col)
|
stack.append(col)
|
||||||
# if col.name == "()":
|
if col.name == "()": # Skip Instances.
|
||||||
# continue
|
continue
|
||||||
indent = (len(stack) - 1) * " "
|
indent = (len(stack) - 1) * " "
|
||||||
self._tw.line("%s%s" % (indent, col))
|
self._tw.line("%s%s" % (indent, col))
|
||||||
|
|
||||||
|
|
|
@ -1408,9 +1408,7 @@ def test_customize_through_attributes(testdir):
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
result = testdir.runpytest("--collect-only")
|
result = testdir.runpytest("--collect-only")
|
||||||
result.stdout.fnmatch_lines(
|
result.stdout.fnmatch_lines(["*MyClass*", "*MyFunction*test_hello*"])
|
||||||
["*MyClass*", "*MyInstance*", "*MyFunction*test_hello*"]
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_unorderable_types(testdir):
|
def test_unorderable_types(testdir):
|
||||||
|
|
Loading…
Reference in New Issue