diff --git a/setup.py b/setup.py index cab11cb..c77972e 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ from setuptools import setup setup( name="pytest-xdist", - version='1.5a7', + version='1.5a8', description='py.test xdist plugin for distributed testing and loop-on-failing modes', long_description=__doc__, license='GPLv2 or later', diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index 7f5de0c..d097afa 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -144,7 +144,7 @@ class TestDistribution: subdir.ensure("__init__.py") p = subdir.join("test_one.py") p.write("def test_5():\n assert not __file__.startswith(%r)" % str(p)) - result = testdir.runpytest("-v", "-d", + result = testdir.runpytest("-v", "-d", "--rsyncdir=%(subdir)s" % locals(), "--tx=popen//chdir=%(dest)s" % locals(), p) assert result.ret == 0 @@ -394,3 +394,18 @@ def test_crashing_item(testdir): +def test_skipping(testdir): + p = testdir.makepyfile(""" + import pytest + def test_crash(): + pytest.skip("hello") + """) + result = testdir.runpytest("-n1", '-rs', p) + assert result.ret == 0 + result.stdout.fnmatch_lines([ + "*hello*", + "*1 skipped*" + ]) + + + diff --git a/testing/test_remote.py b/testing/test_remote.py index 60d0a24..ef5f0d2 100644 --- a/testing/test_remote.py +++ b/testing/test_remote.py @@ -88,8 +88,8 @@ class TestReportSerialization: assert newrep.passed == rep.passed assert newrep.failed == rep.failed assert newrep.skipped == rep.skipped - if newrep.skipped: - assert len(newrep.reprcrash) == 3 + if newrep.skipped and 'xfail' not in newrep.keywords: + assert len(newrep.longrepr) == 3 assert newrep.outcome == rep.outcome assert newrep.when == rep.when assert newrep.keywords == rep.keywords diff --git a/xdist/__init__.py b/xdist/__init__.py index ac59ec9..8b94661 100644 --- a/xdist/__init__.py +++ b/xdist/__init__.py @@ -1,2 +1,2 @@ # -__version__ = '1.5a7' +__version__ = '1.5a8' diff --git a/xdist/dsession.py b/xdist/dsession.py index 658c328..c6b1468 100644 --- a/xdist/dsession.py +++ b/xdist/dsession.py @@ -274,12 +274,12 @@ class DSession: if rep.when in ("setup", "call"): self.sched.remove_item(node, rep.nodeid) #self.report_line("testreport %s: %s" %(rep.id, rep.status)) - enrich_report_with_platform_data(rep, node) + rep.node = node self.config.hook.pytest_runtest_logreport(report=rep) self._handlefailures(rep) def slave_teardownreport(self, node, rep): - enrich_report_with_platform_data(rep, node) + rep.node = node self.config.hook.pytest__teardown_final_logerror(report=rep) def slave_collectreport(self, node, rep): @@ -307,7 +307,7 @@ class DSession: msg = "Slave %r crashed while running %r" %(slave.gateway.id, nodeid) rep = runner.TestReport(nodeid, (fspath, None, fspath), (), "failed", msg, "???") - enrich_report_with_platform_data(rep, slave) + rep.node = slave self.config.hook.pytest_runtest_logreport(report=rep) class TerminalDistReporter: @@ -346,14 +346,3 @@ class TerminalDistReporter: # targets = ", ".join(["[%s]" % gw.id for gw in gateways]) # self.write_line("rsyncfinish: %s -> %s" %(source, targets)) - -def enrich_report_with_platform_data(rep, node): - rep.node = node - if hasattr(rep, 'node') and rep.longrepr: - d = node.slaveinfo - ver = "%s.%s.%s" % d['version_info'][:3] - infoline = "[%s] %s -- Python %s %s" % ( - d['id'], d['sysplatform'], ver, d['executable']) - # XXX more structured longrepr? - rep.longrepr = infoline + "\n\n" + str(rep.longrepr) - diff --git a/xdist/remote.py b/xdist/remote.py index 2f8a8d2..aa382b7 100644 --- a/xdist/remote.py +++ b/xdist/remote.py @@ -85,7 +85,10 @@ class SlaveInteractor: def serialize_report(rep): import py d = rep.__dict__.copy() - d['longrepr'] = rep.longrepr and str(rep.longrepr) or None + if hasattr(rep.longrepr, 'toterminal'): + d['longrepr'] = str(rep.longrepr) + else: + d['longrepr'] = rep.longrepr for name in d: if isinstance(d[name], py.path.local): d[name] = str(d[name])