diff --git a/changelog/1071.bugfix b/changelog/1071.bugfix new file mode 100644 index 00000000..089a4ef1 --- /dev/null +++ b/changelog/1071.bugfix @@ -0,0 +1 @@ +Add backward compatibility for deadlock issue with the ``execnet`` new ``main_thread_only`` "execmodel" triggered when pytest-cov accesses rinfo. diff --git a/src/xdist/workermanage.py b/src/xdist/workermanage.py index 5570e1de..44d1be4c 100644 --- a/src/xdist/workermanage.py +++ b/src/xdist/workermanage.py @@ -312,6 +312,11 @@ def shutting_down(self) -> bool: def setup(self) -> None: self.log("setting up worker session") + # Cache rinfo for backward compatibility, since pytest-cov + # accesses rinfo while the main thread is busy executing our + # remote_exec call, which triggers a deadlock error for the + # main_thread_only execmodel if the rinfo has not been cached. + self.gateway._rinfo() spec = self.gateway.spec args = [str(x) for x in self.config.invocation_params.args or ()] option_dict = {}