Skip to content

Commit 2bc7805

Browse files
committed
Ack PyPy SyntaxError
1 parent 07c0f86 commit 2bc7805

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

testsuite/test_api.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,15 @@ def test_check_nullbytes(self):
330330
pep8style = pep8.StyleGuide()
331331
count_errors = pep8style.input_file('stdin', lines=['\x00\n'])
332332

333-
self.assertTrue(sys.stdout[0].startswith("stdin:1:1: E901 TypeError"),
334-
msg='Output is %r' % sys.stdout[0])
333+
stdout = sys.stdout.getvalue()
334+
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))
335342
self.assertFalse(sys.stderr)
336343
self.assertEqual(count_errors, 1)
337344

0 commit comments

Comments
 (0)