fix and shorten collection reporting and fix a test wrt internal pytest api
This commit is contained in:
2
setup.py
2
setup.py
@@ -2,7 +2,7 @@ from setuptools import setup
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="pytest-xdist",
|
name="pytest-xdist",
|
||||||
version='1.5',
|
version='1.6',
|
||||||
description='py.test xdist plugin for distributed testing and loop-on-failing modes',
|
description='py.test xdist plugin for distributed testing and loop-on-failing modes',
|
||||||
long_description=open('README.txt').read(),
|
long_description=open('README.txt').read(),
|
||||||
license='GPLv2 or later',
|
license='GPLv2 or later',
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ def test_remoteinitconfig(testdir):
|
|||||||
config1 = testdir.parseconfig()
|
config1 = testdir.parseconfig()
|
||||||
config2 = remote_initconfig(config1.option.__dict__, config1.args)
|
config2 = remote_initconfig(config1.option.__dict__, config1.args)
|
||||||
assert config2.option.__dict__ == config1.option.__dict__
|
assert config2.option.__dict__ == config1.option.__dict__
|
||||||
py.test.raises(KeyError, 'config2.pluginmanager.getplugin("terminal")')
|
assert config2.pluginmanager.getplugin("terminal") == None
|
||||||
|
|
||||||
class TestReportSerialization:
|
class TestReportSerialization:
|
||||||
def test_itemreport_outcomes(self, testdir):
|
def test_itemreport_outcomes(self, testdir):
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
#
|
#
|
||||||
__version__ = '1.5'
|
__version__ = '1.6'
|
||||||
|
|||||||
@@ -267,6 +267,7 @@ class DSession:
|
|||||||
|
|
||||||
if self.sched.collection_is_completed:
|
if self.sched.collection_is_completed:
|
||||||
if self.terminal:
|
if self.terminal:
|
||||||
|
self.trdist.ensure_show_status()
|
||||||
self.terminal.write_line("")
|
self.terminal.write_line("")
|
||||||
self.terminal.write_line("scheduling tests via %s" %(
|
self.terminal.write_line("scheduling tests via %s" %(
|
||||||
self.sched.__class__.__name__))
|
self.sched.__class__.__name__))
|
||||||
@@ -327,13 +328,19 @@ class TerminalDistReporter:
|
|||||||
def write_line(self, msg):
|
def write_line(self, msg):
|
||||||
self.tr.write_line(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):
|
def setstatus(self, spec, status, show=True):
|
||||||
self._status[spec.id] = status
|
self._status[spec.id] = status
|
||||||
if show:
|
if show and self.tr.hasmarkup:
|
||||||
|
self.rewrite(self.getstatus())
|
||||||
|
|
||||||
|
def getstatus(self):
|
||||||
parts = ["%s %s" %(spec.id, self._status[spec.id])
|
parts = ["%s %s" %(spec.id, self._status[spec.id])
|
||||||
for spec in self._specs]
|
for spec in self._specs]
|
||||||
line = " / ".join(parts)
|
return " / ".join(parts)
|
||||||
self.rewrite(line)
|
|
||||||
|
|
||||||
def rewrite(self, line, newline=False):
|
def rewrite(self, line, newline=False):
|
||||||
pline = line + " " * max(self._lastlen-len(line), 0)
|
pline = line + " " * max(self._lastlen-len(line), 0)
|
||||||
@@ -347,8 +354,9 @@ class TerminalDistReporter:
|
|||||||
def pytest_xdist_setupnodes(self, specs):
|
def pytest_xdist_setupnodes(self, specs):
|
||||||
self._specs = specs
|
self._specs = specs
|
||||||
for spec in specs:
|
for spec in specs:
|
||||||
self.setstatus(spec, "initializing", show=False)
|
self.setstatus(spec, "I", show=False)
|
||||||
self.setstatus(spec, "initializing", show=True)
|
self.setstatus(spec, "I", show=True)
|
||||||
|
self.ensure_show_status()
|
||||||
|
|
||||||
def pytest_xdist_newgateway(self, gateway):
|
def pytest_xdist_newgateway(self, gateway):
|
||||||
if self.config.option.verbose > 0:
|
if self.config.option.verbose > 0:
|
||||||
@@ -357,7 +365,7 @@ class TerminalDistReporter:
|
|||||||
self.rewrite("[%s] %s Python %s cwd: %s" % (
|
self.rewrite("[%s] %s Python %s cwd: %s" % (
|
||||||
gateway.id, rinfo.platform, version, rinfo.cwd),
|
gateway.id, rinfo.platform, version, rinfo.cwd),
|
||||||
newline=True)
|
newline=True)
|
||||||
self.setstatus(gateway.spec, "collecting")
|
self.setstatus(gateway.spec, "C")
|
||||||
|
|
||||||
def pytest_testnodeready(self, node):
|
def pytest_testnodeready(self, node):
|
||||||
if self.config.option.verbose > 0:
|
if self.config.option.verbose > 0:
|
||||||
@@ -366,7 +374,7 @@ class TerminalDistReporter:
|
|||||||
d['id'],
|
d['id'],
|
||||||
d['version'].replace('\n', ' -- '),)
|
d['version'].replace('\n', ' -- '),)
|
||||||
self.rewrite(infoline, newline=True)
|
self.rewrite(infoline, newline=True)
|
||||||
self.setstatus(node.gateway.spec, "ready")
|
self.setstatus(node.gateway.spec, "ok")
|
||||||
|
|
||||||
def pytest_testnodedown(self, node, error):
|
def pytest_testnodedown(self, node, error):
|
||||||
if not error:
|
if not error:
|
||||||
|
|||||||
Reference in New Issue
Block a user