[Pytest-commit] commit/pytest: RonnyPfannschmidt: fix issue 271 - dont write junitxml on slave nodes
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Sun Mar 24 20:43:54 CET 2013
1 new commit in pytest:
https://bitbucket.org/hpk42/pytest/commits/14df4b5c4e82/
Changeset: 14df4b5c4e82
User: RonnyPfannschmidt
Date: 2013-03-24 20:43:25
Summary: fix issue 271 - dont write junitxml on slave nodes
Affected #: 3 files
diff -r 8908cc8650ff538acbfa175a5d5e07effa140c23 -r 14df4b5c4e82c3ac9f9f1189fa13e89907317d48 CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,8 @@
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
when doctest does not know the example location
diff -r 8908cc8650ff538acbfa175a5d5e07effa140c23 -r 14df4b5c4e82c3ac9f9f1189fa13e89907317d48 _pytest/junitxml.py
--- a/_pytest/junitxml.py
+++ b/_pytest/junitxml.py
@@ -70,7 +70,8 @@
def pytest_configure(config):
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.pluginmanager.register(config._xml)
diff -r 8908cc8650ff538acbfa175a5d5e07effa140c23 -r 14df4b5c4e82c3ac9f9f1189fa13e89907317d48 testing/test_junitxml.py
--- a/testing/test_junitxml.py
+++ b/testing/test_junitxml.py
@@ -289,6 +289,25 @@
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:
def test_summing_simple(self, testdir):
testdir.makeconftest("""
Repository URL: https://bitbucket.org/hpk42/pytest/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the pytest-commit
mailing list