Skip to content

Commit e8c220b

Browse files
committed
Increase required verbosity level for debug output
To show the subclassed file in legacy test suits in the runtest output you have to set the verbosity level to at least "-vv" now. Closes #3211
1 parent 58b6e86 commit e8c220b

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

changelog/4159.feature.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
For test-suites containing test classes, the information about the subclassed
2+
module is now output only if a higher verbosity level is specified (at least
3+
"-vv").

src/_pytest/terminal.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,9 @@ def mkrel(nodeid):
676676

677677
if fspath:
678678
res = mkrel(nodeid).replace("::()", "") # parens-normalization
679-
if nodeid.split("::")[0] != fspath.replace("\\", nodes.SEP):
679+
if self.verbosity >= 2 and nodeid.split("::")[0] != fspath.replace(
680+
"\\", nodes.SEP
681+
):
680682
res += " <- " + self.startdir.bestrelpath(fspath)
681683
else:
682684
res = "[location]"

testing/acceptance_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -760,8 +760,8 @@ def join_pythonpath(*dirs):
760760
if hasattr(py.path.local, "mksymlinkto"):
761761
result.stdout.fnmatch_lines(
762762
[
763-
"lib/foo/bar/test_bar.py::test_bar <- local/lib/foo/bar/test_bar.py PASSED*",
764-
"lib/foo/bar/test_bar.py::test_other <- local/lib/foo/bar/test_bar.py PASSED*",
763+
"lib/foo/bar/test_bar.py::test_bar PASSED*",
764+
"lib/foo/bar/test_bar.py::test_other PASSED*",
765765
"*2 passed*",
766766
]
767767
)

testing/test_terminal.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ class TestMore(BaseTests):
154154
)
155155
result = testdir.runpytest(p2)
156156
result.stdout.fnmatch_lines(["*test_p2.py .*", "*1 passed*"])
157-
result = testdir.runpytest("-v", p2)
157+
result = testdir.runpytest("-vv", p2)
158158
result.stdout.fnmatch_lines(
159159
["*test_p2.py::TestMore::test_p1* <- *test_p1.py*PASSED*"]
160160
)
@@ -170,7 +170,7 @@ def test_method(self):
170170
"""
171171
)
172172
)
173-
result = testdir.runpytest("-v")
173+
result = testdir.runpytest("-vv")
174174
assert result.ret == 0
175175
result.stdout.fnmatch_lines(["*a123/test_hello123.py*PASS*"])
176176
assert " <- " not in result.stdout.str()

0 commit comments

Comments
 (0)