[py-svn] py-trunk commit ae39db5c4322: fix issue 57 - make --looponfail work with xpassing tests

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Wed May 26 18:54:57 CEST 2010


# HG changeset patch -- Bitbucket.org
# Project py-trunk
# URL http://bitbucket.org/hpk42/py-trunk/overview
# User holger krekel <holger at merlinux.eu>
# Date 1274892950 -7200
# Node ID ae39db5c43222c4c87a2d59982e8a1a66bcaa303
# Parent  8ad40decae54b92b3b70287c321a9853e3f1da01
fix issue 57 - make --looponfail work with xpassing tests

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

--- a/testing/plugin/test_pytest_terminal.py
+++ b/testing/plugin/test_pytest_terminal.py
@@ -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),
         ])

--- a/setup.py
+++ b/setup.py
@@ -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'],

--- a/py/__init__.py
+++ b/py/__init__.py
@@ -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
 

--- a/CHANGELOG
+++ b/CHANGELOG
@@ -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
 ==================================================



More information about the pytest-commit mailing list