]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-35794: Catch PermissionError in test_no_such_executable (GH-11635)
authorPablo Galindo <Pablogsal@gmail.com>
Mon, 21 Jan 2019 14:35:43 +0000 (14:35 +0000)
committerGitHub <noreply@github.com>
Mon, 21 Jan 2019 14:35:43 +0000 (14:35 +0000)
PermissionError can be raised if there are directories in the $PATH that are not accessible
when using posix_spawnp.

Lib/test/test_posix.py

index 79fc3c264418674034dede55d999076bdc3501d2..165b837134087b00d6237655c92334d7c4b5cd4a 100644 (file)
@@ -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)