From 00dc8eeaff17fc5a8303dc53ff74f0a1ba711570 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sat, 23 Mar 2024 20:40:54 +0200 Subject: [PATCH] Remove pytest InvocationParams backward compat It's available since pytest 5.2, and pytest-xdist requires pytest>=6.2. --- src/xdist/remote.py | 11 +---------- src/xdist/workermanage.py | 8 ++------ testing/test_remote.py | 10 ---------- 3 files changed, 3 insertions(+), 26 deletions(-) diff --git a/src/xdist/remote.py b/src/xdist/remote.py index e035f77..679df3c 100644 --- a/src/xdist/remote.py +++ b/src/xdist/remote.py @@ -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): config.option.loadgroup = config.getvalue("dist") == "loadgroup" config.option.looponfail = False @@ -341,11 +336,7 @@ if __name__ == "__channelexec__": os.environ["PYTEST_XDIST_WORKER"] = workerinput["workerid"] os.environ["PYTEST_XDIST_WORKER_COUNT"] = str(workerinput["workercount"]) - if hasattr(Config, "InvocationParams"): - config = _prepareconfig(args, None) - else: - config = remote_initconfig(option_dict, args) - config.args = args + config = _prepareconfig(args, None) setup_config(config, option_dict.get("basetemp")) config._parser.prog = os.path.basename(workerinput["mainargv"][0]) diff --git a/src/xdist/workermanage.py b/src/xdist/workermanage.py index fdd4109..9c72431 100644 --- a/src/xdist/workermanage.py +++ b/src/xdist/workermanage.py @@ -258,12 +258,8 @@ class WorkerController: def setup(self): self.log("setting up worker session") spec = self.gateway.spec - if hasattr(self.config, "invocation_params"): - args = [str(x) for x in self.config.invocation_params.args or ()] - option_dict = {} - else: - args = self.config.args - option_dict = vars(self.config.option) + args = [str(x) for x in self.config.invocation_params.args or ()] + option_dict = {} if not spec.popen or spec.chdir: args = make_reltoroot(self.nodemanager.roots, args) if spec.popen: diff --git a/testing/test_remote.py b/testing/test_remote.py index 2d250c5..4e37262 100644 --- a/testing/test_remote.py +++ b/testing/test_remote.py @@ -70,16 +70,6 @@ def worker(request, pytester: pytest.Pytester) -> WorkerSetup: 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: @pytest.fixture def unserialize_report(self, pytestconfig):