Author: Armin Rigo <ar...@tunes.org>
Branch: cffi-1.0
Changeset: r77188:f3185bf12230
Date: 2015-05-08 09:01 +0200
http://bitbucket.org/pypy/pypy/changeset/f3185bf12230/

Log:    Now the tests start passing

diff --git a/pypy/module/_cffi_backend/test/test_recompiler.py 
b/pypy/module/_cffi_backend/test/test_recompiler.py
--- a/pypy/module/_cffi_backend/test/test_recompiler.py
+++ b/pypy/module/_cffi_backend/test/test_recompiler.py
@@ -2,6 +2,8 @@
 
 from rpython.tool.udir import udir
 from pypy.interpreter.gateway import unwrap_spec, interp2app
+from pypy.module._cffi_backend.newtype import _clean_cache
+import pypy.module.cpyext.api     # side-effect of pre-importing it
 
 
 @unwrap_spec(cdef=str, module_name=str, source=str)
@@ -44,6 +46,21 @@
     def setup_class(cls):
         cls.w_prepare = cls.space.wrap(interp2app(prepare))
 
+    def setup_method(self, meth):
+        self._w_modules = self.space.appexec([], """():
+            import sys
+            return set(sys.modules)
+        """)
+
+    def teardown_method(self, meth):
+        self.space.appexec([self._w_modules], """(old_modules):
+            import sys
+            for key in sys.modules.keys():
+                if key not in old_modules:
+                    del sys.modules[key]
+        """)
+        _clean_cache(self.space)
+
     def test_math_sin(self):
         import math
         ffi, lib = self.prepare(
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to