Remove pytest InvocationParams backward compat
It's available since pytest 5.2, and pytest-xdist requires pytest>=6.2.
This commit is contained in:
@@ -308,11 +308,6 @@ def getinfodict():
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def remote_initconfig(option_dict, args):
|
|
||||||
option_dict["plugins"].append("no:terminal")
|
|
||||||
return Config.fromdictargs(option_dict, args)
|
|
||||||
|
|
||||||
|
|
||||||
def setup_config(config, basetemp):
|
def setup_config(config, basetemp):
|
||||||
config.option.loadgroup = config.getvalue("dist") == "loadgroup"
|
config.option.loadgroup = config.getvalue("dist") == "loadgroup"
|
||||||
config.option.looponfail = False
|
config.option.looponfail = False
|
||||||
@@ -341,11 +336,7 @@ if __name__ == "__channelexec__":
|
|||||||
os.environ["PYTEST_XDIST_WORKER"] = workerinput["workerid"]
|
os.environ["PYTEST_XDIST_WORKER"] = workerinput["workerid"]
|
||||||
os.environ["PYTEST_XDIST_WORKER_COUNT"] = str(workerinput["workercount"])
|
os.environ["PYTEST_XDIST_WORKER_COUNT"] = str(workerinput["workercount"])
|
||||||
|
|
||||||
if hasattr(Config, "InvocationParams"):
|
config = _prepareconfig(args, None)
|
||||||
config = _prepareconfig(args, None)
|
|
||||||
else:
|
|
||||||
config = remote_initconfig(option_dict, args)
|
|
||||||
config.args = args
|
|
||||||
|
|
||||||
setup_config(config, option_dict.get("basetemp"))
|
setup_config(config, option_dict.get("basetemp"))
|
||||||
config._parser.prog = os.path.basename(workerinput["mainargv"][0])
|
config._parser.prog = os.path.basename(workerinput["mainargv"][0])
|
||||||
|
|||||||
@@ -258,12 +258,8 @@ class WorkerController:
|
|||||||
def setup(self):
|
def setup(self):
|
||||||
self.log("setting up worker session")
|
self.log("setting up worker session")
|
||||||
spec = self.gateway.spec
|
spec = self.gateway.spec
|
||||||
if hasattr(self.config, "invocation_params"):
|
args = [str(x) for x in self.config.invocation_params.args or ()]
|
||||||
args = [str(x) for x in self.config.invocation_params.args or ()]
|
option_dict = {}
|
||||||
option_dict = {}
|
|
||||||
else:
|
|
||||||
args = self.config.args
|
|
||||||
option_dict = vars(self.config.option)
|
|
||||||
if not spec.popen or spec.chdir:
|
if not spec.popen or spec.chdir:
|
||||||
args = make_reltoroot(self.nodemanager.roots, args)
|
args = make_reltoroot(self.nodemanager.roots, args)
|
||||||
if spec.popen:
|
if spec.popen:
|
||||||
|
|||||||
@@ -70,16 +70,6 @@ def worker(request, pytester: pytest.Pytester) -> WorkerSetup:
|
|||||||
return WorkerSetup(request, pytester)
|
return WorkerSetup(request, pytester)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.xfail(reason="#59")
|
|
||||||
def test_remoteinitconfig(pytester: pytest.Pytester) -> None:
|
|
||||||
from xdist.remote import remote_initconfig
|
|
||||||
|
|
||||||
config1 = pytester.parseconfig()
|
|
||||||
config2 = remote_initconfig(config1.option.__dict__, config1.args)
|
|
||||||
assert config2.option.__dict__ == config1.option.__dict__
|
|
||||||
assert config2.pluginmanager.getplugin("terminal") in (-1, None)
|
|
||||||
|
|
||||||
|
|
||||||
class TestWorkerInteractor:
|
class TestWorkerInteractor:
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def unserialize_report(self, pytestconfig):
|
def unserialize_report(self, pytestconfig):
|
||||||
|
|||||||
Reference in New Issue
Block a user