You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BTW it looks like the original proposal by @bphunter1972 in #3123 of a runner.set_filesystem context manager seems to address the thread-safety as each runner will produce its artefacts and assets in its own directory on CLI invokation.
To clarify: tox parallel is for running multiple interpreter environments in parallel. It is not the same as running the tests in one interpreter in parallel. I've never had an expectation that tests should be thread safe. If you were to use pytest-xdist it would use processes to run subsets of tests serially.
For free threading, I'd expect test runners (unittest, pytest, etc) to provide a way to manage threads and locks for unsafe tests. That's getting way outside the scope of Click and this function.
I can't tell what the comment from @Rowlando13 was saying, given the above. There's also no more information in this issue. We also all agree this function should be deprecated. Therefore I think this issue should be closed.
My comment was specifically that I thought that isolated_filesystem creates a folder and then makes expectations about what is in that folder, so if there are multiple isolated_filesystem calls in a test suite and the tests are running in parallel there is a race condition between those tests.
I closed the related issue. I see why this should be separate and stay open if only to clarify a bit. Even with separate interpreters, I don't see how tox -p is safe(since each suite at various times make random folders, does stuff, and looks in them) unless tox runs the interpreters from different base folders.
isolated_filesystem calls tempfile.mkdtemp, so every invocation is a separate folder. It does call os.chdir, which isn't thread safe, but serializing that should be left to the test framework, not us. tox p does create a separate base dir for every environment.
Given #3676 , I guess the milestone change to 9.0.0 is just the blast radius of the recent main <-> stable dance. So I retarget this to 8.5.0 unless an explicit decision is made.
Activity
davidism commentedon May 23, 2026
Reminder that we should probably deprecate
isolated_filesystem, there's a discussion about that somewhere around here.kdeldycke commentedon May 23, 2026
Found it at: #3123 (comment)
kdeldycke commentedon May 23, 2026
BTW it looks like the original proposal by @bphunter1972 in #3123 of a
runner.set_filesystemcontext manager seems to address the thread-safety as each runner will produce its artefacts and assets in its own directory on CLI invokation.davidism commentedon May 29, 2026
To clarify:
tox parallelis for running multiple interpreter environments in parallel. It is not the same as running the tests in one interpreter in parallel. I've never had an expectation that tests should be thread safe. If you were to use pytest-xdist it would use processes to run subsets of tests serially.For free threading, I'd expect test runners (unittest, pytest, etc) to provide a way to manage threads and locks for unsafe tests. That's getting way outside the scope of Click and this function.
I can't tell what the comment from @Rowlando13 was saying, given the above. There's also no more information in this issue. We also all agree this function should be deprecated. Therefore I think this issue should be closed.
Rowlando13 commentedon May 29, 2026
My comment was specifically that I thought that isolated_filesystem creates a folder and then makes expectations about what is in that folder, so if there are multiple isolated_filesystem calls in a test suite and the tests are running in parallel there is a race condition between those tests.
Rowlando13 commentedon May 29, 2026
I agree with deprecating isolated_filesystem. Better to show a pytest example.
Rowlando13 commentedon May 29, 2026
I closed the related issue. I see why this should be separate and stay open if only to clarify a bit. Even with separate interpreters, I don't see how tox -p is safe(since each suite at various times make random folders, does stuff, and looks in them) unless tox runs the interpreters from different base folders.
davidism commentedon May 29, 2026
isolated_filesystemcallstempfile.mkdtemp, so every invocation is a separate folder. It does callos.chdir, which isn't thread safe, but serializing that should be left to the test framework, not us.tox pdoes create a separate base dir for every environment.Rowlando13 commentedon May 29, 2026
Thanks for explaining. Closing issue.
kdeldycke commentedon Jul 8, 2026
Given #3676 , I guess the milestone change to 9.0.0 is just the blast radius of the recent
main<->stabledance. So I retarget this to 8.5.0 unless an explicit decision is made.kdeldycke commentedon Jul 17, 2026
I created a dedicated issue at #3700
Deprecate `isolated_filesystem` and document its limits
Deprecate `isolated_filesystem` and document its limits
Deprecate `isolated_filesystem` and document its limits