]> granicus.if.org Git - python/commitdiff
test_main_invalid_unicode() of test_sys displays stderr on failure
authorVictor Stinner <victor.stinner@haypocalc.com>
Thu, 19 Aug 2010 17:18:12 +0000 (17:18 +0000)
committerVictor Stinner <victor.stinner@haypocalc.com>
Thu, 19 Aug 2010 17:18:12 +0000 (17:18 +0000)
Lib/test/test_sys.py

index eb50bbb40a39d2a63a830b80f9f9526418adb9c9..130aa6618895df4a639a5d37eea1be464f4d21d6 100644 (file)
@@ -510,10 +510,9 @@ class SysModuleTest(unittest.TestCase):
         p = subprocess.Popen([sys.executable, "-c", code], stderr=subprocess.PIPE)
         stdout, stderr = p.communicate()
         self.assertEqual(p.returncode, 1)
-        lines = stderr.splitlines()
-        self.assertGreaterEqual(len(lines), 2)
-        self.assertEqual(b"Unable to decode the command from the command line:", lines[0])
-        self.assertIn(br"UnicodeEncodeError:", lines[1])
+        pattern = b"Unable to decode the command from the command line:"
+        if not stderr.startswith(pattern):
+            raise AssertionError("%a doesn't start with %a" % (stderr, pattern))
 
     def test_sys_flags(self):
         self.assertTrue(sys.flags)