https://github.com/python/cpython/commit/8ada7a9e1435302ec2cb73375122072d0e1cdd6f
commit: 8ada7a9e1435302ec2cb73375122072d0e1cdd6f
branch: main
author: Thomas Grainger <[email protected]>
committer: vstinner <[email protected]>
date: 2025-03-25T18:16:15+01:00
summary:
gh-131647: fix 'sys.path_hooks is empty' warning in test_importlib (#131648)
files:
M Lib/test/test_importlib/import_/test_path.py
diff --git a/Lib/test/test_importlib/import_/test_path.py
b/Lib/test/test_importlib/import_/test_path.py
index 51ff6115e1281e..79e0bdca94c15c 100644
--- a/Lib/test/test_importlib/import_/test_path.py
+++ b/Lib/test/test_importlib/import_/test_path.py
@@ -158,11 +158,15 @@ def test_deleted_cwd(self):
def test_permission_error_cwd(self):
# gh-115911: Test that an unreadable CWD does not break imports, in
# particular during early stages of interpreter startup.
+
+ def noop_hook(*args):
+ raise ImportError
+
with (
os_helper.temp_dir() as new_dir,
os_helper.save_mode(new_dir),
os_helper.change_cwd(new_dir),
- util.import_state(path=['']),
+ util.import_state(path=[''], path_hooks=[noop_hook]),
):
# chmod() is done here (inside the 'with' block) because the order
# of teardown operations cannot be the reverse of setup order. See
_______________________________________________
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]