adapt to pytest trunk changes - config moved to plugin
This commit is contained in:
@@ -1,38 +0,0 @@
|
|||||||
import py
|
|
||||||
|
|
||||||
@py.test.mark.xfail("sys.version_info[:2] == (2,7)")
|
|
||||||
def test_dist_conftest_options(testdir, recwarn):
|
|
||||||
p1 = testdir.tmpdir.ensure("dir", 'p1.py')
|
|
||||||
p1.dirpath("__init__.py").write("")
|
|
||||||
p1.dirpath("conftest.py").write(py.code.Source("""
|
|
||||||
import py
|
|
||||||
from py.builtin import print_
|
|
||||||
print_("importing conftest", __file__)
|
|
||||||
Option = py.test.config.Option
|
|
||||||
option = py.test.config.addoptions("someopt",
|
|
||||||
Option('--someopt', action="store_true",
|
|
||||||
dest="someopt", default=False))
|
|
||||||
dist_rsync_roots = ['../dir']
|
|
||||||
print_("added options", option)
|
|
||||||
print_("config file seen from conftest", py.test.config)
|
|
||||||
"""))
|
|
||||||
p1.write(py.code.Source("""
|
|
||||||
import py
|
|
||||||
from %s import conftest
|
|
||||||
from py.builtin import print_
|
|
||||||
def test_1():
|
|
||||||
print_("config from test_1", py.test.config)
|
|
||||||
print_("conftest from test_1", conftest.__file__)
|
|
||||||
print_("test_1: py.test.config.option.someopt", py.test.config.option.someopt)
|
|
||||||
print_("test_1: conftest", conftest)
|
|
||||||
print_("test_1: conftest.option.someopt", conftest.option.someopt)
|
|
||||||
assert conftest.option.someopt
|
|
||||||
""" % p1.dirpath().purebasename ))
|
|
||||||
result = testdir.runpytest('-d', '--tx=popen', p1, '--someopt')
|
|
||||||
assert result.ret == 0
|
|
||||||
result.stderr.fnmatch_lines([
|
|
||||||
"*Deprecation*pytest_addoptions*",
|
|
||||||
])
|
|
||||||
result.stdout.fnmatch_lines([
|
|
||||||
"*1 passed*",
|
|
||||||
])
|
|
||||||
@@ -60,10 +60,8 @@ def pytest_funcarg__slave(request):
|
|||||||
def test_remoteinitconfig(testdir):
|
def test_remoteinitconfig(testdir):
|
||||||
from xdist.remote import remote_initconfig
|
from xdist.remote import remote_initconfig
|
||||||
config1 = testdir.parseconfig()
|
config1 = testdir.parseconfig()
|
||||||
config2 = testdir.parseconfig("-x")
|
config2 = remote_initconfig(config1.option.__dict__, config1.args)
|
||||||
cfg = remote_initconfig(config2, config1.option.__dict__, config1.args)
|
assert config2.option.__dict__ == config1.option.__dict__
|
||||||
assert cfg == config2
|
|
||||||
assert cfg.option.__dict__ == config1.option.__dict__
|
|
||||||
|
|
||||||
class TestReportSerialization:
|
class TestReportSerialization:
|
||||||
def test_itemreport_outcomes(self, testdir):
|
def test_itemreport_outcomes(self, testdir):
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ def pytest_funcarg__hookrecorder(request):
|
|||||||
|
|
||||||
def pytest_funcarg__hook(request):
|
def pytest_funcarg__hook(request):
|
||||||
from xdist import newhooks
|
from xdist import newhooks
|
||||||
from pytest.pluginmanager import HookRelay, Registry
|
from pytest._core import HookRelay, Registry
|
||||||
from pytest.plugin import hookspec
|
from pytest import hookspec
|
||||||
return HookRelay([hookspec, newhooks], Registry())
|
return HookRelay([hookspec, newhooks], Registry())
|
||||||
|
|
||||||
class pytest_funcarg__mysetup:
|
class pytest_funcarg__mysetup:
|
||||||
|
|||||||
@@ -123,7 +123,8 @@ def init_slave_session(channel, args, option_dict):
|
|||||||
sys.path[:] = newpaths
|
sys.path[:] = newpaths
|
||||||
|
|
||||||
#fullwidth, hasmarkup = channel.receive()
|
#fullwidth, hasmarkup = channel.receive()
|
||||||
config = py.test.config
|
from pytest.plugin.config import Config
|
||||||
|
config = Config()
|
||||||
config.option.__dict__.update(option_dict)
|
config.option.__dict__.update(option_dict)
|
||||||
config._preparse(args)
|
config._preparse(args)
|
||||||
config.args = args
|
config.args = args
|
||||||
|
|||||||
@@ -101,7 +101,9 @@ def getinfodict():
|
|||||||
cwd = os.getcwd(),
|
cwd = os.getcwd(),
|
||||||
)
|
)
|
||||||
|
|
||||||
def remote_initconfig(config, option_dict, args):
|
def remote_initconfig(option_dict, args):
|
||||||
|
from pytest.plugin.config import Config
|
||||||
|
config = Config()
|
||||||
config._preparse(args)
|
config._preparse(args)
|
||||||
config.option.__dict__.update(option_dict)
|
config.option.__dict__.update(option_dict)
|
||||||
config.option.looponfail = False
|
config.option.looponfail = False
|
||||||
@@ -116,7 +118,7 @@ def remote_initconfig(config, option_dict, args):
|
|||||||
if __name__ == '__channelexec__':
|
if __name__ == '__channelexec__':
|
||||||
slaveinput,args,option_dict = channel.receive()
|
slaveinput,args,option_dict = channel.receive()
|
||||||
import py
|
import py
|
||||||
config = remote_initconfig(py.test.config, option_dict, args)
|
config = remote_initconfig(option_dict, args)
|
||||||
config.slaveinput = slaveinput
|
config.slaveinput = slaveinput
|
||||||
config.slaveoutput = {}
|
config.slaveoutput = {}
|
||||||
interactor = SlaveInteractor(config, channel)
|
interactor = SlaveInteractor(config, channel)
|
||||||
|
|||||||
Reference in New Issue
Block a user