Skip to content

Commit 8ada7a9

Browse files
authored
gh-131647: fix 'sys.path_hooks is empty' warning in test_importlib (#131648)
1 parent ea0453e commit 8ada7a9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Lib/test/test_importlib/import_/test_path.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,15 @@ def test_deleted_cwd(self):
158158
def test_permission_error_cwd(self):
159159
# gh-115911: Test that an unreadable CWD does not break imports, in
160160
# particular during early stages of interpreter startup.
161+
162+
def noop_hook(*args):
163+
raise ImportError
164+
161165
with (
162166
os_helper.temp_dir() as new_dir,
163167
os_helper.save_mode(new_dir),
164168
os_helper.change_cwd(new_dir),
165-
util.import_state(path=['']),
169+
util.import_state(path=[''], path_hooks=[noop_hook]),
166170
):
167171
# chmod() is done here (inside the 'with' block) because the order
168172
# of teardown operations cannot be the reverse of setup order. See

0 commit comments

Comments
 (0)