apply patch from Jakub wrt fixing resultlog/xdist combo
--HG-- branch : trunk
This commit is contained in:
parent
8c0dfb525d
commit
5f9876d54e
|
@ -1,4 +1,4 @@
|
|||
Changes between 1.3.1 and 1.3.x
|
||||
Changes between 1.3.1 and 1.3.2a
|
||||
==================================================
|
||||
|
||||
New features
|
||||
|
@ -56,6 +56,8 @@ Bug fixes / Maintenance
|
|||
- make path.bestrelpath(path) return ".", note that when calling
|
||||
X.bestrelpath the assumption is that X is a directory.
|
||||
- make initial conftest discovery ignore "--" prefixed arguments
|
||||
- fix resultlog plugin when used in an multicpu/multihost xdist situation
|
||||
(thanks Jakub Gustak)
|
||||
|
||||
Changes between 1.3.0 and 1.3.1
|
||||
==================================================
|
||||
|
|
|
@ -16,7 +16,8 @@ def pytest_addoption(parser):
|
|||
|
||||
def pytest_configure(config):
|
||||
resultlog = config.option.resultlog
|
||||
if resultlog:
|
||||
# prevent opening resultlog on slave nodes (xdist)
|
||||
if resultlog and not hasattr(config, 'slaveinput'):
|
||||
logfile = open(resultlog, 'w', 1) # line buffered
|
||||
config._resultlog = ResultLog(config, logfile)
|
||||
config.pluginmanager.register(config._resultlog)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import py
|
||||
import os
|
||||
from py._plugin.pytest_resultlog import generic_path, ResultLog
|
||||
from py._plugin.pytest_resultlog import generic_path, ResultLog, \
|
||||
pytest_configure, pytest_unconfigure
|
||||
from py._test.collect import Node, Item, FSCollector
|
||||
|
||||
def test_generic_path(testdir):
|
||||
|
@ -173,3 +174,18 @@ def test_generic(testdir, LineMatcher):
|
|||
"x *:test_xfail_norun",
|
||||
])
|
||||
|
||||
def test_no_resultlog_on_slaves(testdir):
|
||||
config = testdir.parseconfig("-p", "resultlog", "--resultlog=resultlog")
|
||||
|
||||
assert not hasattr(config, '_resultlog')
|
||||
pytest_configure(config)
|
||||
assert hasattr(config, '_resultlog')
|
||||
pytest_unconfigure(config)
|
||||
assert not hasattr(config, '_resultlog')
|
||||
|
||||
config.slaveinput = {}
|
||||
pytest_configure(config)
|
||||
assert not hasattr(config, '_resultlog')
|
||||
pytest_unconfigure(config)
|
||||
assert not hasattr(config, '_resultlog')
|
||||
|
||||
|
|
Loading…
Reference in New Issue