Skip to content

Commit a2018f4

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 pytest-dev#3211
1 parent 58b6e86 commit a2018f4

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
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/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)