fix slightly wrong verbose output for non subclasses on windows

This commit is contained in:
holger krekel 2011-03-08 13:37:00 +01:00
parent f2670651b3
commit 1a7c6ecc42
3 changed files with 21 additions and 3 deletions

View File

@ -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 - fixed typos in the docs (thanks Victor Garcia, Brianna Laugher) and particular
thanks to Laura Creighton who also revieved parts of the documentation. 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 - more precise (avoiding of) deprecation warnings for node.Class|Function accesses
- avoid std unittest assertion helper code in tracebacks (thanks Ronny) - avoid std unittest assertion helper code in tracebacks (thanks Ronny)

View File

@ -283,7 +283,7 @@ class TerminalReporter:
return return
#for i, testarg in enumerate(self.config.args): #for i, testarg in enumerate(self.config.args):
# self.write_line("test path %d: %s" %(i+1, testarg)) # self.write_line("test path %d: %s" %(i+1, testarg))
def _printcollecteditems(self, items): def _printcollecteditems(self, items):
# to print out items and their parent collectors # to print out items and their parent collectors
# we take care to leave out Instances aka () # we take care to leave out Instances aka ()
@ -335,7 +335,7 @@ class TerminalReporter:
excrepr.reprcrash.toterminal(self._tw) excrepr.reprcrash.toterminal(self._tw)
def _locationline(self, collect_fspath, fspath, lineno, domain): 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) fspath = "%s <- %s" % (collect_fspath, fspath)
if lineno is not None: if lineno is not None:
lineno += 1 lineno += 1

View File

@ -130,6 +130,20 @@ class TestTerminal:
"*test_p2.py <- *test_p1.py:2: TestMore.test_p1*", "*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): def test_keyboard_interrupt(self, testdir, option):
p = testdir.makepyfile(""" p = testdir.makepyfile("""
def test_foobar(): def test_foobar():
@ -399,6 +413,7 @@ class TestTerminalFunctional:
"*test_verbose_reporting.py:10: test_gen*FAIL*", "*test_verbose_reporting.py:10: test_gen*FAIL*",
]) ])
assert result.ret == 1 assert result.ret == 1
pytestconfig.pluginmanager.skipifmissing("xdist") pytestconfig.pluginmanager.skipifmissing("xdist")
result = testdir.runpytest(p1, '-v', '-n 1') result = testdir.runpytest(p1, '-v', '-n 1')
result.stdout.fnmatch_lines([ result.stdout.fnmatch_lines([
@ -507,7 +522,7 @@ def test_PYTEST_DEBUG(testdir, monkeypatch):
result.stderr.fnmatch_lines([ result.stderr.fnmatch_lines([
"*registered*PluginManager*" "*registered*PluginManager*"
]) ])
class TestGenericReporting: class TestGenericReporting:
""" this test class can be subclassed with a different option """ this test class can be subclassed with a different option