fix and shorten collection reporting and fix a test wrt internal pytest api

This commit is contained in:
holger krekel
2010-12-07 12:00:22 +01:00
parent a6a4158b78
commit 1c712fe6a0
4 changed files with 20 additions and 12 deletions

View File

@@ -2,7 +2,7 @@ from setuptools import setup
setup(
name="pytest-xdist",
version='1.5',
version='1.6',
description='py.test xdist plugin for distributed testing and loop-on-failing modes',
long_description=open('README.txt').read(),
license='GPLv2 or later',

View File

@@ -62,7 +62,7 @@ def test_remoteinitconfig(testdir):
config1 = testdir.parseconfig()
config2 = remote_initconfig(config1.option.__dict__, config1.args)
assert config2.option.__dict__ == config1.option.__dict__
py.test.raises(KeyError, 'config2.pluginmanager.getplugin("terminal")')
assert config2.pluginmanager.getplugin("terminal") == None
class TestReportSerialization:
def test_itemreport_outcomes(self, testdir):

View File

@@ -1,2 +1,2 @@
#
__version__ = '1.5'
__version__ = '1.6'

View File

@@ -267,6 +267,7 @@ class DSession:
if self.sched.collection_is_completed:
if self.terminal:
self.trdist.ensure_show_status()
self.terminal.write_line("")
self.terminal.write_line("scheduling tests via %s" %(
self.sched.__class__.__name__))
@@ -327,13 +328,19 @@ class TerminalDistReporter:
def write_line(self, msg):
self.tr.write_line(msg)
def ensure_show_status(self):
if not self.tr.hasmarkup:
self.write_line(self.getstatus())
def setstatus(self, spec, status, show=True):
self._status[spec.id] = status
if show:
parts = ["%s %s" %(spec.id, self._status[spec.id])
for spec in self._specs]
line = " / ".join(parts)
self.rewrite(line)
if show and self.tr.hasmarkup:
self.rewrite(self.getstatus())
def getstatus(self):
parts = ["%s %s" %(spec.id, self._status[spec.id])
for spec in self._specs]
return " / ".join(parts)
def rewrite(self, line, newline=False):
pline = line + " " * max(self._lastlen-len(line), 0)
@@ -347,8 +354,9 @@ class TerminalDistReporter:
def pytest_xdist_setupnodes(self, specs):
self._specs = specs
for spec in specs:
self.setstatus(spec, "initializing", show=False)
self.setstatus(spec, "initializing", show=True)
self.setstatus(spec, "I", show=False)
self.setstatus(spec, "I", show=True)
self.ensure_show_status()
def pytest_xdist_newgateway(self, gateway):
if self.config.option.verbose > 0:
@@ -357,7 +365,7 @@ class TerminalDistReporter:
self.rewrite("[%s] %s Python %s cwd: %s" % (
gateway.id, rinfo.platform, version, rinfo.cwd),
newline=True)
self.setstatus(gateway.spec, "collecting")
self.setstatus(gateway.spec, "C")
def pytest_testnodeready(self, node):
if self.config.option.verbose > 0:
@@ -366,7 +374,7 @@ class TerminalDistReporter:
d['id'],
d['version'].replace('\n', ' -- '),)
self.rewrite(infoline, newline=True)
self.setstatus(node.gateway.spec, "ready")
self.setstatus(node.gateway.spec, "ok")
def pytest_testnodedown(self, node, error):
if not error: