summaryrefslogtreecommitdiff
path: root/Lib/test/test_subprocess.py
diff options
context:
space:
mode:
authorXavier de Gaye <xdegaye@users.sourceforge.net>2016-11-14 17:14:42 +0100
committerXavier de Gaye <xdegaye@users.sourceforge.net>2016-11-14 17:14:42 +0100
commit38c8b7d2922c20010930eedacdccf61fb2246761 (patch)
tree46380aa06548d786d0f0990bdbb04122e2e3f116 /Lib/test/test_subprocess.py
parent8bf43e6d0b3dc5d76e9d99656528ccdcd5dd6e6a (diff)
downloadcpython-git-38c8b7d2922c20010930eedacdccf61fb2246761.tar.gz
Issue #28662: Catch PermissionError in tests when spawning a non existent program
Diffstat (limited to 'Lib/test/test_subprocess.py')
-rw-r--r--Lib/test/test_subprocess.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py
index 2d9239c759..73da1956ea 100644
--- a/Lib/test/test_subprocess.py
+++ b/Lib/test/test_subprocess.py
@@ -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: