Skip to content

Commit 8eec111

Browse files
committed
Fix test on Windows: catch PermissionError
1 parent fb03867 commit 8eec111

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Lib/test/test_importlib/test_util.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -799,8 +799,9 @@ def test_package(self):
799799
with open(filename, "w", encoding="utf8") as fp:
800800
print("attr = 'load_source_path_pkg'", file=fp)
801801

802-
# Package cannot be imported from a directory
803-
with self.assertRaises(IsADirectoryError):
802+
# Package cannot be imported from a directory. It can with
803+
# IsADirectoryError on Unix and PermissionError on Windows.
804+
with self.assertRaises(OSError):
804805
importlib.util.load_source_path(modname, dirname)
805806

806807
# Loading a package __init__.py file is ok

0 commit comments

Comments
 (0)