We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 07c0f86 commit 2bc7805Copy full SHA for 2bc7805
1 file changed
testsuite/test_api.py
@@ -330,8 +330,15 @@ def test_check_nullbytes(self):
330
pep8style = pep8.StyleGuide()
331
count_errors = pep8style.input_file('stdin', lines=['\x00\n'])
332
333
- self.assertTrue(sys.stdout[0].startswith("stdin:1:1: E901 TypeError"),
334
- msg='Output is %r' % sys.stdout[0])
+ stdout = sys.stdout.getvalue()
+ if 'SyntaxError' in stdout:
335
+ # PyPy 2.2 returns a SyntaxError
336
+ expected = "stdin:1:2: E901 SyntaxError"
337
+ else:
338
+ expected = "stdin:1:1: E901 TypeError"
339
+ self.assertTrue(stdout.startswith(expected),,
340
+ msg='Output %r does not start with %r' %
341
+ (stdout, expected))
342
self.assertFalse(sys.stderr)
343
self.assertEqual(count_errors, 1)
344
0 commit comments