diff Lib/test/test_subprocess.py @ 80375:9180fb4eccc7

Raise our own SubprocessError rather than a RuntimeError in when dealing with odd rare errors coming from the subprocess module.
author Gregory P. Smith <greg@krypto.org>
date Sat, 10 Nov 2012 23:53:47 -0800
parents a6a6c349af7e
children d51df72dadb7
line wrap: on
line diff
--- a/Lib/test/test_subprocess.py	Sat Nov 10 23:35:15 2012 -0800
+++ b/Lib/test/test_subprocess.py	Sat Nov 10 23:53:47 2012 -0800
@@ -1179,7 +1179,7 @@
         try:
             p = subprocess.Popen([sys.executable, "-c", ""],
                                  preexec_fn=raise_it)
-        except RuntimeError as e:
+        except subprocess.SubprocessError as e:
             self.assertTrue(
                     subprocess._posixsubprocess,
                     "Expected a ValueError from the preexec_fn")
@@ -1544,12 +1544,12 @@
             # Pure Python implementations keeps the message
             self.assertIsNone(subprocess._posixsubprocess)
             self.assertEqual(str(err), "surrogate:\uDCff")
-        except RuntimeError as err:
+        except subprocess.SubprocessError as err:
             # _posixsubprocess uses a default message
             self.assertIsNotNone(subprocess._posixsubprocess)
             self.assertEqual(str(err), "Exception occurred in preexec_fn.")
         else:
-            self.fail("Expected ValueError or RuntimeError")
+            self.fail("Expected ValueError or subprocess.SubprocessError")
 
     def test_undecodable_env(self):
         for key, value in (('test', 'abc\uDCFF'), ('test\uDCFF', '42')):