Skip to content

test_import leaves files in the current directory #155731

Description

@serhiy-storchaka

Bug report

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.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13bugs and security fixes3.14bugs and security fixes3.15pre-release feature fixes, bugs and security fixes3.16new features, bugs and security fixestestsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions