Kaydet (Commit) 515ca204 authored tarafından Victor Stinner's avatar Victor Stinner

test_main_invalid_unicode() of test_sys displays stderr on failure

üst 38430e2d
...@@ -510,10 +510,9 @@ class SysModuleTest(unittest.TestCase): ...@@ -510,10 +510,9 @@ class SysModuleTest(unittest.TestCase):
p = subprocess.Popen([sys.executable, "-c", code], stderr=subprocess.PIPE) p = subprocess.Popen([sys.executable, "-c", code], stderr=subprocess.PIPE)
stdout, stderr = p.communicate() stdout, stderr = p.communicate()
self.assertEqual(p.returncode, 1) self.assertEqual(p.returncode, 1)
lines = stderr.splitlines() pattern = b"Unable to decode the command from the command line:"
self.assertGreaterEqual(len(lines), 2) if not stderr.startswith(pattern):
self.assertEqual(b"Unable to decode the command from the command line:", lines[0]) raise AssertionError("%a doesn't start with %a" % (stderr, pattern))
self.assertIn(br"UnicodeEncodeError:", lines[1])
def test_sys_flags(self): def test_sys_flags(self):
self.assertTrue(sys.flags) self.assertTrue(sys.flags)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment