[pypy-commit] pypy py3k: fix test on CPython

rlamy pypy.commits at gmail.com
Thu Oct 6 12:24:18 EDT 2016


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: py3k
Changeset: r87616:51af7033c330
Date: 2016-10-06 17:23 +0100
http://bitbucket.org/pypy/pypy/changeset/51af7033c330/

Log:	fix test on CPython

diff --git a/pypy/module/cpyext/test/test_bytearrayobject.py b/pypy/module/cpyext/test/test_bytearrayobject.py
--- a/pypy/module/cpyext/test/test_bytearrayobject.py
+++ b/pypy/module/cpyext/test/test_bytearrayobject.py
@@ -101,6 +101,7 @@
         assert s == b'test'
 
     def test_manipulations(self):
+        import sys
         module = self.import_extension('foo', [
             ("bytearray_from_bytes", "METH_VARARGS",
              '''
@@ -143,7 +144,9 @@
              """)])
         assert module.bytearray_from_bytes(b"huheduwe") == b"huhe"
         assert module.bytes_from_bytearray(bytearray(b'abc')) == b'abc'
-        raises(ValueError, module.bytes_from_bytearray, 4.0)
+        if '__pypy__' in sys.builtin_module_names:
+            # CPython only makes an assert.
+            raises(ValueError, module.bytes_from_bytearray, 4.0)
         ret = module.concat(b'abc', b'def')
         assert ret == b'abcdef'
         assert not isinstance(ret, str)


More information about the pypy-commit mailing list