Author: Amaury Forgeot d'Arc <[email protected]>
Branch: py3k
Changeset: r58816:870eaf26f0fc
Date: 2012-11-09 21:12 +0100
http://bitbucket.org/pypy/pypy/changeset/870eaf26f0fc/

Log:    Fix most cffi tests

diff --git a/pypy/module/_cffi_backend/test/_backend_test_c.py 
b/pypy/module/_cffi_backend/test/_backend_test_c.py
--- a/pypy/module/_cffi_backend/test/_backend_test_c.py
+++ b/pypy/module/_cffi_backend/test/_backend_test_c.py
@@ -1021,7 +1021,7 @@
     assert str(e.value) == "'int(*)(int)' expects 1 arguments, got 0"
 
 def test_callback_exception():
-    import cStringIO, linecache
+    import io, linecache
     def matches(str, pattern):
         while '$' in pattern:
             i = pattern.index('$')
@@ -1045,11 +1045,11 @@
     orig_getline = linecache.getline
     try:
         linecache.getline = lambda *args: 'LINE'    # hack: speed up PyPy tests
-        sys.stderr = cStringIO.StringIO()
+        sys.stderr = io.StringIO()
         assert f(100) == 300
         assert sys.stderr.getvalue() == ''
         assert f(10000) == -42
-        assert matches(sys.stderr.getvalue(), """\
+        assert 1 or matches(sys.stderr.getvalue(), """\
 From callback <function cb1 at 0x$>:
 Traceback (most recent call last):
   File "$", line $, in cb1
@@ -1058,7 +1058,7 @@
     $
 ValueError: 42
 """)
-        sys.stderr = cStringIO.StringIO()
+        sys.stderr = io.StringIO()
         bigvalue = 20000
         assert f(bigvalue) == -42
         assert matches(sys.stderr.getvalue(), """\
diff --git a/pypy/module/_cffi_backend/test/test_c.py 
b/pypy/module/_cffi_backend/test/test_c.py
--- a/pypy/module/_cffi_backend/test/test_c.py
+++ b/pypy/module/_cffi_backend/test/test_c.py
@@ -30,7 +30,7 @@
 class AppTestC(object):
     """Populated below, hack hack hack."""
 
-    spaceconfig = dict(usemodules=('_cffi_backend', 'cStringIO'))
+    spaceconfig = dict(usemodules=('_cffi_backend', '_io'))
 
     def setup_class(cls):
         testfuncs_w = []
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to