mirror of
https://github.com/python/cpython.git
synced 2025-12-23 09:19:18 +00:00
gh-131647: fix 'sys.path_hooks is empty' warning in test_importlib (#131648)
This commit is contained in:
parent
ea0453ee97
commit
8ada7a9e14
1 changed files with 5 additions and 1 deletions
|
|
@ -158,11 +158,15 @@ class FinderTests:
|
|||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue