[Python-checkins] r84205 - python/branches/py3k/Lib/test/test_sys.py

victor.stinner python-checkins at python.org
Thu Aug 19 19:18:13 CEST 2010


Author: victor.stinner
Date: Thu Aug 19 19:18:12 2010
New Revision: 84205

Log:
test_main_invalid_unicode() of test_sys displays stderr on failure


Modified:
   python/branches/py3k/Lib/test/test_sys.py

Modified: python/branches/py3k/Lib/test/test_sys.py
==============================================================================
--- python/branches/py3k/Lib/test/test_sys.py	(original)
+++ python/branches/py3k/Lib/test/test_sys.py	Thu Aug 19 19:18:12 2010
@@ -510,10 +510,9 @@
         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)


More information about the Python-checkins mailing list