-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
The tmp_path
fixture documentation (https://docs.pytest.org/en/7.1.x/how-to/tmp_path.html#the-tmp-path-fixture) states that temporary directories are unique for each "test invocation". This is correct in the sense that each test function is associated by a single unique temporary directory.
However, this is not correct when considering running the same test function concurrently by distinct pytest invocations. We are doing this all the time using Tox where tests are executed from multiple virtualenvs (different Python versions), concurrently.
In that scenario, the tmp_path
generated directory is shared/clashes between multiple invocations.
I appreciate that the solution is to uniqueify the temp path prefix, similar to what the pytest-xdist
extension does. With Tox, that is trivial to achieve. Reading the Pytest docs, I do not necessarily know that I need that solution.