fix issue 57 - make --looponfail work with xpassing tests

--HG--
branch : trunk
This commit is contained in:
holger krekel 2010-05-26 18:55:50 +02:00
parent 73d9900844
commit b66b5e2715
5 changed files with 28 additions and 6 deletions

View File

@ -1,3 +1,14 @@
Changes between 1.3.1 and 1.3.x
==================================================
New features
++++++++++++++++++
Bug fixes
++++++++++++++++++
- fix issue57 -f|--looponfail to work with xpassing tests
Changes between 1.3.0 and 1.3.1
==================================================

View File

@ -8,7 +8,7 @@ dictionary or an import path.
(c) Holger Krekel and others, 2004-2010
"""
__version__ = version = "1.3.1"
__version__ = version = "1.3.2a1"
import py.apipkg

View File

@ -207,6 +207,7 @@ class TerminalReporter:
self.write_sep("#", "LOOPONFAILING", red=True)
for report in failreports:
loc = self._getcrashline(report)
if loc:
self.write_line(loc, red=True)
self.write_sep("#", "waiting for changes")
for rootdir in rootdirs:
@ -325,7 +326,10 @@ class TerminalReporter:
try:
return report.longrepr.reprcrash
except AttributeError:
try:
return str(report.longrepr)[:50]
except AttributeError:
return ""
def _reportinfoline(self, item):
collect_fspath = self._getfspath(item)

View File

@ -26,7 +26,7 @@ def main():
name='py',
description='py.test and pylib: rapid testing and development utils.',
long_description = long_description,
version= '1.3.1',
version= '1.3.2a1',
url='http://pylib.org',
license='MIT license',
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],

View File

@ -133,17 +133,24 @@ class TestTerminal:
def test_looponfailreport(self, testdir, linecomp):
modcol = testdir.getmodulecol("""
import py
def test_fail():
assert 0
def test_fail2():
raise ValueError()
@py.test.mark.xfail
def test_xfail():
assert 0
@py.test.mark.xfail
def test_xpass():
assert 1
""")
rep = TerminalReporter(modcol.config, file=linecomp.stringio)
reports = [basic_run_report(x) for x in modcol.collect()]
rep.pytest_looponfailinfo(reports, [modcol.config.topdir])
linecomp.assert_contains_lines([
"*test_looponfailreport.py:2: assert 0",
"*test_looponfailreport.py:4: ValueError*",
"*test_looponfailreport.py:3: assert 0",
"*test_looponfailreport.py:5: ValueError*",
"*waiting*",
"*%s*" % (modcol.config.topdir),
])