summaryrefslogtreecommitdiff
path: root/testsuite/test_api.py
diff options
context:
space:
mode:
authorFlorent Xicluna <florent.xicluna@gmail.com>2014-03-26 00:43:59 +0100
committerFlorent Xicluna <florent.xicluna@gmail.com>2014-03-26 00:43:59 +0100
commit2bc78056e8269e4a0986104208533a68d0f58f11 (patch)
tree262e480be955ea7c63920795b5a720bbe01adc99 /testsuite/test_api.py
parent07c0f86e0b43e52b005ca6539b2d908e0c730a7e (diff)
downloadpep8-2bc78056e8269e4a0986104208533a68d0f58f11.tar.gz
Ack PyPy SyntaxError
Diffstat (limited to 'testsuite/test_api.py')
-rw-r--r--testsuite/test_api.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/testsuite/test_api.py b/testsuite/test_api.py
index 1846096..ea18eca 100644
--- a/testsuite/test_api.py
+++ b/testsuite/test_api.py
@@ -330,8 +330,15 @@ class APITestCase(unittest.TestCase):
pep8style = pep8.StyleGuide()
count_errors = pep8style.input_file('stdin', lines=['\x00\n'])
- self.assertTrue(sys.stdout[0].startswith("stdin:1:1: E901 TypeError"),
- msg='Output is %r' % sys.stdout[0])
+ stdout = sys.stdout.getvalue()
+ if 'SyntaxError' in stdout:
+ # PyPy 2.2 returns a SyntaxError
+ expected = "stdin:1:2: E901 SyntaxError"
+ else:
+ expected = "stdin:1:1: E901 TypeError"
+ self.assertTrue(stdout.startswith(expected),,
+ msg='Output %r does not start with %r' %
+ (stdout, expected))
self.assertFalse(sys.stderr)
self.assertEqual(count_errors, 1)