diff --git a/CHANGELOG b/CHANGELOG index eed468cdd..adc1b95df 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -41,6 +41,9 @@ Changes between 2.0.1 and 2.0.2 - fixed typos in the docs (thanks Victor Garcia, Brianna Laugher) and particular thanks to Laura Creighton who also revieved parts of the documentation. +- fix slighly wrong output of verbose progress reporting for classes + (thanks Amaury) + - more precise (avoiding of) deprecation warnings for node.Class|Function accesses - avoid std unittest assertion helper code in tracebacks (thanks Ronny) diff --git a/_pytest/terminal.py b/_pytest/terminal.py index afd5ffefa..cd5a4dc30 100644 --- a/_pytest/terminal.py +++ b/_pytest/terminal.py @@ -283,7 +283,7 @@ class TerminalReporter: return #for i, testarg in enumerate(self.config.args): # self.write_line("test path %d: %s" %(i+1, testarg)) - + def _printcollecteditems(self, items): # to print out items and their parent collectors # we take care to leave out Instances aka () @@ -335,7 +335,7 @@ class TerminalReporter: excrepr.reprcrash.toterminal(self._tw) def _locationline(self, collect_fspath, fspath, lineno, domain): - if fspath and fspath != collect_fspath: + if fspath and fspath.replace("\\", "/") != collect_fspath: fspath = "%s <- %s" % (collect_fspath, fspath) if lineno is not None: lineno += 1 diff --git a/testing/test_terminal.py b/testing/test_terminal.py index 5d8efc2e0..e7ff53d8e 100644 --- a/testing/test_terminal.py +++ b/testing/test_terminal.py @@ -130,6 +130,20 @@ class TestTerminal: "*test_p2.py <- *test_p1.py:2: TestMore.test_p1*", ]) + def test_itemreport_directclasses_not_shown_as_subclasses(self, testdir): + a = testdir.mkpydir("a") + a.join("test_hello.py").write(py.code.Source(""" + class TestClass: + def test_method(self): + pass + """)) + result = testdir.runpytest("-v") + assert result.ret == 0 + result.stdout.fnmatch_lines([ + "*a/test_hello.py*PASS*", + ]) + assert " <- " not in result.stdout.str() + def test_keyboard_interrupt(self, testdir, option): p = testdir.makepyfile(""" def test_foobar(): @@ -399,6 +413,7 @@ class TestTerminalFunctional: "*test_verbose_reporting.py:10: test_gen*FAIL*", ]) assert result.ret == 1 + pytestconfig.pluginmanager.skipifmissing("xdist") result = testdir.runpytest(p1, '-v', '-n 1') result.stdout.fnmatch_lines([ @@ -507,7 +522,7 @@ def test_PYTEST_DEBUG(testdir, monkeypatch): result.stderr.fnmatch_lines([ "*registered*PluginManager*" ]) - + class TestGenericReporting: """ this test class can be subclassed with a different option