diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c9e506d8..326ae664 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -34,7 +34,6 @@ jobs: fail-fast: false matrix: tox_env: - - "py37-pytestlatest" - "py38-pytestlatest" - "py39-pytestlatest" - "py310-pytestlatest" @@ -46,8 +45,6 @@ jobs: os: [ubuntu-latest, windows-latest] include: - - tox_env: "py37-pytestlatest" - python: "3.7" - tox_env: "py38-pytestlatest" python: "3.8" - tox_env: "py39-pytestlatest" diff --git a/pyproject.toml b/pyproject.toml index bb6cc5e1..addb3ff8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,16 +25,15 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", ] -requires-python = ">=3.7" +requires-python = ">=3.8" dependencies = [ - "execnet>=1.1", + "execnet@git+https://github.com/pytest-dev/execnet#egg=master", "pytest>=6.2.0", ] dynamic = ["version"] diff --git a/src/xdist/looponfail.py b/src/xdist/looponfail.py index 7ef24c15..97dd05cd 100644 --- a/src/xdist/looponfail.py +++ b/src/xdist/looponfail.py @@ -76,7 +76,7 @@ def trace(self, *args): print("RemoteControl:", msg) def initgateway(self): - return execnet.makegateway("popen") + return execnet.makegateway("execmodel=main_thread_only//popen") def setup(self, out=None): if out is None: diff --git a/src/xdist/workermanage.py b/src/xdist/workermanage.py index fdd4109a..fc2a3a16 100644 --- a/src/xdist/workermanage.py +++ b/src/xdist/workermanage.py @@ -41,13 +41,15 @@ def __init__(self, config, specs=None, defaultchdir="pyexecnetcache") -> None: self.testrunuid = self.config.getoption("testrunuid") if self.testrunuid is None: self.testrunuid = uuid.uuid4().hex - self.group = execnet.Group() + self.group = execnet.Group(execmodel="main_thread_only") if specs is None: specs = self._getxspecs() self.specs = [] for spec in specs: if not isinstance(spec, execnet.XSpec): spec = execnet.XSpec(spec) + if getattr(spec, "execmodel", None) != "main_thread_only": + spec = execnet.XSpec(f"execmodel=main_thread_only//{spec}") if not spec.chdir and not spec.popen: spec.chdir = defaultchdir self.group.allocate_id(spec) @@ -68,6 +70,10 @@ def setup_nodes(self, putevent): return [self.setup_node(spec, putevent) for spec in self.specs] def setup_node(self, spec, putevent): + if not isinstance(spec, execnet.XSpec): + spec = execnet.XSpec(spec) + if getattr(spec, "execmodel", None) != "main_thread_only": + spec = execnet.XSpec(f"execmodel=main_thread_only//{spec}") gw = self.group.makegateway(spec) self.config.hook.pytest_xdist_newgateway(gateway=gw) self.rsync_roots(gw) diff --git a/testing/test_remote.py b/testing/test_remote.py index 2d250c5b..8c60a824 100644 --- a/testing/test_remote.py +++ b/testing/test_remote.py @@ -38,7 +38,7 @@ def __init__(self, request, pytester: pytest.Pytester) -> None: def setup(self) -> None: self.pytester.chdir() # import os ; os.environ['EXECNET_DEBUG'] = "2" - self.gateway = execnet.makegateway() + self.gateway = execnet.makegateway("execmodel=main_thread_only//popen") self.config = config = self.pytester.parseconfigure() putevent = self.events.put if self.use_callback else None diff --git a/testing/test_workermanage.py b/testing/test_workermanage.py index 6f5a3a46..0cc2d25d 100644 --- a/testing/test_workermanage.py +++ b/testing/test_workermanage.py @@ -72,7 +72,7 @@ def test_popen_makegateway_events( assert len(call.specs) == 2 call = hookrecorder.popcall("pytest_xdist_newgateway") - assert call.gateway.spec == execnet.XSpec("popen") + assert call.gateway.spec == execnet.XSpec("execmodel=main_thread_only//popen") assert call.gateway.id == "gw0" call = hookrecorder.popcall("pytest_xdist_newgateway") assert call.gateway.id == "gw1" @@ -162,7 +162,7 @@ def test_hrsync_filter(self, source: Path, dest: Path) -> None: assert names == {"dir", "file.txt", "somedir"} def test_hrsync_one_host(self, source: Path, dest: Path) -> None: - gw = execnet.makegateway("popen//chdir=%s" % dest) + gw = execnet.makegateway("execmodel=main_thread_only//popen//chdir=%s" % dest) finished = [] rsync = HostRSync(source) rsync.add_target_host(gw, finished=lambda: finished.append(1)) diff --git a/tox.ini b/tox.ini index ca1310a2..9914642a 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,7 @@ [tox] envlist= linting - py{37,38,39,310,311,312}-pytestlatest + py{38,39,310,311,312}-pytestlatest py310-pytestmain py310-psutil py310-setproctitle