fix issue 271 - dont write junitxml on slave nodes
This commit is contained in:
parent
93da606763
commit
76fb51a4ba
|
@ -1,6 +1,8 @@
|
||||||
Changes between 2.3.4 and 2.3.5dev
|
Changes between 2.3.4 and 2.3.5dev
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
|
||||||
|
- issue 271 - dont write junitxml on slave nodes
|
||||||
|
|
||||||
- Issue 274 - dont try to show full doctest example
|
- Issue 274 - dont try to show full doctest example
|
||||||
when doctest does not know the example location
|
when doctest does not know the example location
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,8 @@ def pytest_addoption(parser):
|
||||||
|
|
||||||
def pytest_configure(config):
|
def pytest_configure(config):
|
||||||
xmlpath = config.option.xmlpath
|
xmlpath = config.option.xmlpath
|
||||||
if xmlpath:
|
# prevent opening xmllog on slave nodes (xdist)
|
||||||
|
if xmlpath and not hasattr(config, 'slaveinput'):
|
||||||
config._xml = LogXML(xmlpath, config.option.junitprefix)
|
config._xml = LogXML(xmlpath, config.option.junitprefix)
|
||||||
config.pluginmanager.register(config._xml)
|
config.pluginmanager.register(config._xml)
|
||||||
|
|
||||||
|
|
|
@ -289,6 +289,25 @@ def test_mangle_testnames():
|
||||||
assert newnames == ["a.pything", "Class", "method"]
|
assert newnames == ["a.pything", "Class", "method"]
|
||||||
|
|
||||||
|
|
||||||
|
def test_dont_configure_on_slaves(tmpdir):
|
||||||
|
gotten = []
|
||||||
|
class FakeConfig:
|
||||||
|
def __init__(self):
|
||||||
|
self.pluginmanager = self
|
||||||
|
self.option = self
|
||||||
|
junitprefix = None
|
||||||
|
#XXX: shouldnt need tmpdir ?
|
||||||
|
xmlpath = str(tmpdir.join('junix.xml'))
|
||||||
|
register = gotten.append
|
||||||
|
fake_config = FakeConfig()
|
||||||
|
from _pytest import junitxml
|
||||||
|
junitxml.pytest_configure(fake_config)
|
||||||
|
assert len(gotten) == 1
|
||||||
|
FakeConfig.slaveinput = None
|
||||||
|
junitxml.pytest_configure(fake_config)
|
||||||
|
assert len(gotten) == 1
|
||||||
|
|
||||||
|
|
||||||
class TestNonPython:
|
class TestNonPython:
|
||||||
def test_summing_simple(self, testdir):
|
def test_summing_simple(self, testdir):
|
||||||
testdir.makeconftest("""
|
testdir.makeconftest("""
|
||||||
|
|
Loading…
Reference in New Issue