diff options
author | robot-piglet <[email protected]> | 2025-08-28 14:27:58 +0300 |
---|---|---|
committer | robot-piglet <[email protected]> | 2025-08-28 14:57:06 +0300 |
commit | 81d828c32c8d5477cb2f0ce5da06a1a8d9392ca3 (patch) | |
tree | 3081d566f0d5158d76e9093261344f6406fd09f7 /contrib/python/portalocker/py3/tests/conftest.py | |
parent | 77ea11423f959e51795cc3ef36a48d808b4ffb98 (diff) |
Intermediate changes
commit_hash:d5b1af16dbe9030537a04c27eb410c88c2f496cd
Diffstat (limited to 'contrib/python/portalocker/py3/tests/conftest.py')
-rw-r--r-- | contrib/python/portalocker/py3/tests/conftest.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/contrib/python/portalocker/py3/tests/conftest.py b/contrib/python/portalocker/py3/tests/conftest.py new file mode 100644 index 00000000000..cf59e2b32f4 --- /dev/null +++ b/contrib/python/portalocker/py3/tests/conftest.py @@ -0,0 +1,23 @@ +import logging +import pytest +import random +import multiprocessing + +logger = logging.getLogger(__name__) + + +def tmpfile(tmp_path): + filename = tmp_path / str(random.random()) + yield str(filename) + try: + filename.unlink(missing_ok=True) + except PermissionError: + pass + + +def pytest_sessionstart(session): + # Force spawning the process so we don't accidently inherit locks. + # I'm not a 100% certain this will work correctly unfortunately... there + # is some potential for breaking tests + multiprocessing.set_start_method('spawn') |