Use execnet main_thread_only execmodel (#1027)
Use the execnet main_thread_only execmodel so that code which expects to run in the main thread will just work. This execmodel has been merged to the execnet master branch via pytest-dev/execnet#243, so this patch should not be merged until there is a released version of execnet supporting the main_thread_only execmodel. Closes #620
This commit is contained in:
@@ -49,7 +49,7 @@ class WorkerSetup:
|
||||
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
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ class TestNodeManagerPopen:
|
||||
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"
|
||||
@@ -177,7 +177,7 @@ class TestHRSync:
|
||||
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))
|
||||
|
||||
Reference in New Issue
Block a user