mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
Issue #28662: Catch PermissionError in tests when spawning a non existent program
This commit is contained in:
parent
8bf43e6d0b
commit
38c8b7d292
3 changed files with 6 additions and 4 deletions
|
@ -293,7 +293,8 @@ class ProcessTestCase(BaseTestCase):
|
|||
# Verify first that the call succeeds without the executable arg.
|
||||
pre_args = [sys.executable, "-c"]
|
||||
self._assert_python(pre_args)
|
||||
self.assertRaises(FileNotFoundError, self._assert_python, pre_args,
|
||||
self.assertRaises((FileNotFoundError, PermissionError),
|
||||
self._assert_python, pre_args,
|
||||
executable="doesnotexist")
|
||||
|
||||
@unittest.skipIf(mswindows, "executable argument replaces shell")
|
||||
|
@ -2753,7 +2754,7 @@ class ContextManagerTests(BaseTestCase):
|
|||
self.assertEqual(proc.returncode, 1)
|
||||
|
||||
def test_invalid_args(self):
|
||||
with self.assertRaises(FileNotFoundError) as c:
|
||||
with self.assertRaises((FileNotFoundError, PermissionError)) as c:
|
||||
with subprocess.Popen(['nonexisting_i_hope'],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE) as proc:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue