Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 515ca20

Browse files
author
Victor Stinner
committed
test_main_invalid_unicode() of test_sys displays stderr on failure
1 parent 38430e2 commit 515ca20

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

Lib/test/test_sys.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -510,10 +510,9 @@ def test_main_invalid_unicode(self):
510510
p = subprocess.Popen([sys.executable, "-c", code], stderr=subprocess.PIPE)
511511
stdout, stderr = p.communicate()
512512
self.assertEqual(p.returncode, 1)
513-
lines = stderr.splitlines()
514-
self.assertGreaterEqual(len(lines), 2)
515-
self.assertEqual(b"Unable to decode the command from the command line:", lines[0])
516-
self.assertIn(br"UnicodeEncodeError:", lines[1])
513+
pattern = b"Unable to decode the command from the command line:"
514+
if not stderr.startswith(pattern):
515+
raise AssertionError("%a doesn't start with %a" % (stderr, pattern))
517516

518517
def test_sys_flags(self):
519518
self.assertTrue(sys.flags)

0 commit comments

Comments
 (0)