[Python-checkins] bpo-35794: Catch PermissionError in test_no_such_executable (GH-11635)

Pablo Galindo webhook-mailer at python.org
Mon Jan 21 09:35:50 EST 2019


https://github.com/python/cpython/commit/e9b185f2a493cc54f0d49eac44bf21e8d7de2990
commit: e9b185f2a493cc54f0d49eac44bf21e8d7de2990
branch: master
author: Pablo Galindo <Pablogsal at gmail.com>
committer: GitHub <noreply at github.com>
date: 2019-01-21T14:35:43Z
summary:

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.

files:
M Lib/test/test_posix.py

diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
index 79fc3c264418..165b83713408 100644
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -1522,7 +1522,9 @@ def test_no_such_executable(self):
             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)



More information about the Python-checkins mailing list