mirror of https://github.com/python/cpython
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.
This commit is contained in:
parent
b2385458ce
commit
e9b185f2a4
|
@ -1522,7 +1522,9 @@ class _PosixSpawnMixin:
|
||||||
pid = self.spawn_func(no_such_executable,
|
pid = self.spawn_func(no_such_executable,
|
||||||
[no_such_executable],
|
[no_such_executable],
|
||||||
os.environ)
|
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)
|
self.assertEqual(exc.filename, no_such_executable)
|
||||||
else:
|
else:
|
||||||
pid2, status = os.waitpid(pid, 0)
|
pid2, status = os.waitpid(pid, 0)
|
||||||
|
|
Loading…
Reference in New Issue