fix and unify remote skip test/collect reports

This commit is contained in:
holger krekel
2010-11-13 20:53:35 +01:00
parent d81ffaa980
commit 47d3e99083
6 changed files with 27 additions and 20 deletions

View File

@@ -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',

View File

@@ -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*"
])

View File

@@ -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

View File

@@ -1,2 +1,2 @@
#
__version__ = '1.5a7'
__version__ = '1.5a8'

View File

@@ -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)

View File

@@ -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])