When running several invocations of pytest on a system at the same time, the instances seem to delete each other's resource file when one of them terminates.
Here is the error I got in a CI invocation. (Note that this setup is not using pytest-isolate at all, it just happens to be installed in the environment.)
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/home/runner/work/cppyy-dev/cppyy-dev/.pixi/envs/cppyy-conda-forge/lib/python3.12/site-packages/_pytest/main.py", line 314, in wrap_session
INTERNALERROR> config._do_configure()
INTERNALERROR> File "/home/runner/work/cppyy-dev/cppyy-dev/.pixi/envs/cppyy-conda-forge/lib/python3.12/site-packages/_pytest/config/__init__.py", line 1128, in _do_configure
INTERNALERROR> self.hook.pytest_configure.call_historic(kwargs=dict(config=self))
INTERNALERROR> File "/home/runner/work/cppyy-dev/cppyy-dev/.pixi/envs/cppyy-conda-forge/lib/python3.12/site-packages/pluggy/_hooks.py", line 534, in call_historic
INTERNALERROR> res = self._hookexec(self.name, self._hookimpls.copy(), kwargs, False)
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/runner/work/cppyy-dev/cppyy-dev/.pixi/envs/cppyy-conda-forge/lib/python3.12/site-packages/pluggy/_manager.py", line 120, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/runner/work/cppyy-dev/cppyy-dev/.pixi/envs/cppyy-conda-forge/lib/python3.12/site-packages/pluggy/_callers.py", line 167, in _multicall
INTERNALERROR> raise exception
INTERNALERROR> File "/home/runner/work/cppyy-dev/cppyy-dev/.pixi/envs/cppyy-conda-forge/lib/python3.12/site-packages/pluggy/_callers.py", line 121, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/home/runner/work/cppyy-dev/cppyy-dev/.pixi/envs/cppyy-conda-forge/lib/python3.12/site-packages/pytest_isolate/plugin.py", line 335, in pytest_configure
INTERNALERROR> clean_resources()
INTERNALERROR> File "/home/runner/work/cppyy-dev/cppyy-dev/.pixi/envs/cppyy-conda-forge/lib/python3.12/site-packages/pytest_isolate/resource_management.py", line 139, in clean_resources
INTERNALERROR> os.remove(DEFAULT_STATE_FILE)
INTERNALERROR> FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pytest_isolate_resources.json'
FAIL eantic_sage.py (exit status: 3)
An easier reproducer:
$ python -m venv pytest-reproducer
$ source pytest-reproducer/bin/activate
$ pip install pytest pytest-isolate
$ cat test.py
#!/bin/env python
import pytest
import sys
def test_random_sleep():
assert True
if __name__ == '__main__':
sys.exit(pytest.main(sys.argv))
$ chmod +x test.py
$ for i in `seq 64`; do ./test.py &; done
On my Linux system this produces quite a few FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pytest_isolate_resources.json'
When running several invocations of pytest on a system at the same time, the instances seem to delete each other's resource file when one of them terminates.
Here is the error I got in a CI invocation. (Note that this setup is not using pytest-isolate at all, it just happens to be installed in the environment.)
An easier reproducer:
On my Linux system this produces quite a few
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pytest_isolate_resources.json'