diff --git a/CHANGELOG b/CHANGELOG index f388af0fc..071757a7d 100644 --- 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 ================================================== diff --git a/py/__init__.py b/py/__init__.py index 31f88b213..701ae2f62 100644 --- 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 diff --git a/py/_plugin/pytest_terminal.py b/py/_plugin/pytest_terminal.py index 7ed0ca85e..84f3d505e 100644 --- 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) diff --git a/setup.py b/setup.py index c6b902848..ff0112821 100644 --- 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'], diff --git a/testing/plugin/test_pytest_terminal.py b/testing/plugin/test_pytest_terminal.py index 00f121f04..bd7dda19b 100644 --- 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), ])