https://github.com/python/cpython/commit/94c606652c4943cb57ec7858d723511559849aab
commit: 94c606652c4943cb57ec7858d723511559849aab
branch: main
author: Serhiy Storchaka <[email protected]>
committer: serhiy-storchaka <[email protected]>
date: 2026-08-14T07:40:01+03:00
summary:
gh-155727: Ignore internal imports in test_attribute_completion (GH-155730)
Reader.run_hooks() imports _pyrepl._threading_handler lazily, and the
test counted it as a module imported by the completer.
files:
M Lib/test/test_pyrepl/test_pyrepl.py
diff --git a/Lib/test/test_pyrepl/test_pyrepl.py
b/Lib/test/test_pyrepl/test_pyrepl.py
index 04a7a1b7f56751e..7cc178f19df6f9d 100644
--- a/Lib/test/test_pyrepl/test_pyrepl.py
+++ b/Lib/test/test_pyrepl/test_pyrepl.py
@@ -1467,7 +1467,10 @@ def test_attribute_completion(self):
reader = self.prepare_reader(events, namespace={})
output = reader.readline()
self.assertEqual(output, expected)
- new_imports = sys.modules.keys() - _imported
+ # The reader imports its own helpers lazily.
+ new_imports = {name for name in
+ sys.modules.keys() - _imported
+ if not name.startswith('_pyrepl.')}
self.assertEqual(new_imports, expected_imports)
@patch.dict(sys.modules)
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]