GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test_import leaves files in the current directory · Issue #155731 · python/cpython

test_import leaves files in the current directory #155731

New issue
Copy link
New issue
Copy link
Closed
Closed
test_import leaves files in the current directory#155731
Copy link
Labels
3.13only security fixesonly security fixes3.14bugs and security fixesbugs and security fixes3.15bugs and security fixesbugs and security fixes3.16new features, bugs and security fixesnew features, bugs and security fixestestsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@serhiy-storchaka
serhiy-storchaka
opened on Aug 13, 2026
Issue body actions

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

  • gh-155731: Clean up files left by test_import #155735
  • [3.15] gh-155731: Clean up files left by test_import (GH-155735) #155739
  • [3.14] gh-155731: Clean up files left by test_import (GH-155735) #155740
  • [3.13] gh-155731: Clean up files left by test_import (GH-155735) #155741
Reacted by Victor Stinner

Activity

  1. serhiy-storchaka
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    testsTests in the Lib/test dirTests in the Lib/test dir
    3.13only security fixesonly security fixes
    3.14bugs and security fixesbugs and security fixes
    3.15bugs and security fixesbugs and security fixes
    3.16new features, bugs and security fixesnew features, bugs and security fixes
    on Aug 13, 2026
  2. nightcityblade commented on Aug 13, 2026

    @nightcityblade
    nightcityblade
    on Aug 13, 2026
    More actions

    Hi, I'd like to work on this. I'll submit a PR shortly.

  3. serhiy-storchaka
    added a commit that references this issue on Aug 13, 2026

    gh-155731: Clean up files left by test_import (GH-155735)

    b0ba60e
  4. serhiy-storchaka
    closed this as completedon Aug 13, 2026
  5. serhiy-storchaka
    added 2 commits that reference this issue on Aug 13, 2026

    [3.13] gh-155731: Clean up files left by test_import (GH-155735) (GH-…

    de63e6e

    [3.14] gh-155731: Clean up files left by test_import (GH-155735) (GH-…

    23bba2f
  6. mbeijen
    added a commit that references this issue on Aug 14, 2026

    pythongh-155731: Clean up files left by test_import (pythonGH-155735)

    d6ff6e2
  7. serhiy-storchaka
    added a commit that references this issue on Oct 10, 2026

    [3.15] gh-155731: Clean up files left by test_import (GH-155735) (GH-…

    b3fab86
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13only security fixesonly security fixes3.14bugs and security fixesbugs and security fixes3.15bugs and security fixesbugs and security fixes3.16new features, bugs and security fixesnew features, bugs and security fixestestsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402520 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.