Skip to content

Commit e9b185f

Browse files
authored
bpo-35794: Catch PermissionError in test_no_such_executable (GH-11635)
PermissionError can be raised if there are directories in the $PATH that are not accessible when using posix_spawnp.
1 parent b238545 commit e9b185f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Lib/test/test_posix.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1522,7 +1522,9 @@ def test_no_such_executable(self):
15221522
pid = self.spawn_func(no_such_executable,
15231523
[no_such_executable],
15241524
os.environ)
1525-
except FileNotFoundError as exc:
1525+
# bpo-35794: PermissionError can be raised if there are
1526+
# directories in the $PATH that are not accessible.
1527+
except (FileNotFoundError, PermissionError) as exc:
15261528
self.assertEqual(exc.filename, no_such_executable)
15271529
else:
15281530
pid2, status = os.waitpid(pid, 0)

0 commit comments

Comments
 (0)