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

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.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