$ ./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
Running the whole file passes: the leftovers are removed by other tests before the environment is checked.
Bug report
Three tests in
test_importleave files in the current directory:ImportTests.test_importandImportTracebackTests.test_unencodable_filenameimport a temporary script and do not remove the__pycache__directory created for it.ImportTests.test_import_in_del_does_not_crashcreates a script withmake_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.
Linked PRs