Skip to content

test_attribute_completion fails because of a lazy internal import #155727

Description

@serhiy-storchaka

Bug report

Reader.run_hooks() imports _pyrepl._threading_handler on the first call if threading is already imported.

TestPyReplModuleCompleter.test_attribute_completion collects the modules imported while the reader runs and compares them with the modules the completer is expected to import, so all 17 subtests fail:

AssertionError: Items in the first set but not the second:
'_pyrepl._threading_handler'
./python -m unittest test.test_pyrepl.test_pyrepl.TestPyReplModuleCompleter.test_attribute_completion

Importing _pyrepl._threading_handler before running the test makes it pass.

Linked PRs

Activity

  1. added
    type-bugAn unexpected behavior, bug, or error
    testsTests in the Lib/test dir
    3.15bugs and security fixes
    3.16new features, bugs and security fixes
    on Aug 13, 2026
  2. added a commit that references this issue on Aug 14, 2026
  3. added a commit that references this issue on Aug 14, 2026
  4. added a commit that references this issue on Aug 27, 2026
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.15bugs 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