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
{{ message }}
Repository navigation
test_import leaves files in the current directory #155731
Three tests in test_import leave files in the current directory:
$ ./python -m test --fail-env-changed test_import -m test.test_import.ImportTests.test_import
Warning -- files was modified by test_import
Warning -- Before: []
Warning -- After: ['__pycache__/']
Result: ENV CHANGED
ImportTests.test_import and ImportTracebackTests.test_unencodable_filename import a temporary script and do not remove the __pycache__ directory created for it.
ImportTests.test_import_in_del_does_not_crash creates a script with make_script() and never unlinks it, leaving @test_<pid>_tmpæ.py.
Running the whole file passes: the leftovers are removed by other tests before the environment is checked.
Activity
nightcityblade commentedon Aug 13, 2026
Hi, I'd like to work on this. I'll submit a PR shortly.
gh-155731: Clean up files left by test_import (GH-155735)
[3.13] gh-155731: Clean up files left by test_import (GH-155735) (GH-…
[3.14] gh-155731: Clean up files left by test_import (GH-155735) (GH-…
pythongh-155731: Clean up files left by test_import (pythonGH-155735)
[3.15] gh-155731: Clean up files left by test_import (GH-155735) (GH-…