Skip to content

Commit 54b8ad4

Browse files
authored
Merge pull request #4159 from thisch/subclassedfile
Increase required verbosity level for debug output
2 parents e4e4fd1 + e8c220b commit 54b8ad4

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
@@ -750,8 +750,8 @@ def test_cmdline_python_package_symlink(self, testdir, monkeypatch):
750750
if hasattr(py.path.local, "mksymlinkto"):
751751
result.stdout.fnmatch_lines(
752752
[
753-
"lib/foo/bar/test_bar.py::test_bar <- local/lib/foo/bar/test_bar.py PASSED*",
754-
"lib/foo/bar/test_bar.py::test_other <- local/lib/foo/bar/test_bar.py PASSED*",
753+
"lib/foo/bar/test_bar.py::test_bar PASSED*",
754+
"lib/foo/bar/test_bar.py::test_other PASSED*",
755755
"*2 passed*",
756756
]
757757
)

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)