From e9b185f2a493cc54f0d49eac44bf21e8d7de2990 Mon Sep 17 00:00:00 2001 From: Pablo Galindo Date: Mon, 21 Jan 2019 14:35:43 +0000 Subject: 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. --- Lib/test/test_posix.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py index 79fc3c2..165b837 100644 --- a/Lib/test/test_posix.py +++ b/Lib/test/test_posix.py @@ -1522,7 +1522,9 @@ class _PosixSpawnMixin: pid = self.spawn_func(no_such_executable, [no_such_executable], os.environ) - except FileNotFoundError as exc: + # bpo-35794: PermissionError can be raised if there are + # directories in the $PATH that are not accessible. + except (FileNotFoundError, PermissionError) as exc: self.assertEqual(exc.filename, no_such_executable) else: pid2, status = os.waitpid(pid, 0) -- cgit v0.12