[pypy-commit] pypy default: Backed out changeset 33d4dcf474ce

arigo pypy.commits at gmail.com
Fri Aug 19 01:41:39 EDT 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r86302:916d5087f471
Date: 2016-08-19 07:41 +0200
http://bitbucket.org/pypy/pypy/changeset/916d5087f471/

Log:	Backed out changeset 33d4dcf474ce

	This broke tests (just run py.test test_re_python.py). We were
	importing modules in every single test, and teardown_method() was
	cleaning it up, to check that there would be no leak.

diff --git a/pypy/module/_cffi_backend/test/test_re_python.py b/pypy/module/_cffi_backend/test/test_re_python.py
--- a/pypy/module/_cffi_backend/test/test_re_python.py
+++ b/pypy/module/_cffi_backend/test/test_re_python.py
@@ -69,21 +69,10 @@
         sub_ffi.set_source('re_py_subsrc', None)
         sub_ffi.emit_python_code(str(tmpdir.join('re_py_subsrc.py')))
         #
-        cls.w_ffi = space.appexec([space.wrap(str(tmpdir))], """(path):
+        space.appexec([space.wrap(str(tmpdir))], """(path):
             import _cffi_backend     # force it to be initialized
             import sys
             sys.path.insert(0, path)
-            from re_python_pysrc import ffi
-            del sys.path[0]
-            return ffi
-        """)
-        cls.w_sub_ffi = space.appexec([space.wrap(str(tmpdir))], """(path):
-            import _cffi_backend     # force it to be initialized
-            import sys
-            sys.path.insert(0, path)
-            from re_py_subsrc import ffi
-            del sys.path[0]
-            return ffi
         """)
 
     def teardown_method(self, meth):
@@ -97,25 +86,25 @@
 
 
     def test_constant_1(self):
-        ffi = self.ffi
+        from re_python_pysrc import ffi
         assert ffi.integer_const('FOOBAR') == -42
         assert ffi.integer_const('FOOBAZ') == -43
 
     def test_large_constant(self):
-        ffi = self.ffi
+        from re_python_pysrc import ffi
         assert ffi.integer_const('BIGPOS') == 420000000000
         assert ffi.integer_const('BIGNEG') == -420000000000
 
     def test_function(self):
         import _cffi_backend
-        ffi = self.ffi
+        from re_python_pysrc import ffi
         lib = ffi.dlopen(self.extmod)
         assert lib.add42(-10) == 32
         assert type(lib.add42) is _cffi_backend.FFI.CData
 
     def test_dlclose(self):
         import _cffi_backend
-        ffi = self.ffi
+        from re_python_pysrc import ffi
         lib = ffi.dlopen(self.extmod)
         ffi.dlclose(lib)
         e = raises(ffi.error, ffi.dlclose, lib)
@@ -126,18 +115,18 @@
             "library '%s' has been closed" % (self.extmod,))
 
     def test_constant_via_lib(self):
-        ffi = self.ffi
+        from re_python_pysrc import ffi
         lib = ffi.dlopen(self.extmod)
         assert lib.FOOBAR == -42
         assert lib.FOOBAZ == -43
 
     def test_opaque_struct(self):
-        ffi = self.ffi
+        from re_python_pysrc import ffi
         ffi.cast("struct foo_s *", 0)
         raises(TypeError, ffi.new, "struct foo_s *")
 
     def test_nonopaque_struct(self):
-        ffi = self.ffi
+        from re_python_pysrc import ffi
         for p in [ffi.new("struct bar_s *", [5, b"foobar"]),
                   ffi.new("bar_t *", [5, b"foobar"])]:
             assert p.x == 5
@@ -145,13 +134,13 @@
             assert p.a[5] == ord('r')
 
     def test_enum(self):
-        ffi = self.ffi
+        from re_python_pysrc import ffi
         assert ffi.integer_const("BB") == 1
         e = ffi.cast("enum foo_e", 2)
         assert ffi.string(e) == "CC"
 
     def test_include_1(self):
-        ffi = self.sub_ffi
+        from re_py_subsrc import ffi
         assert ffi.integer_const('FOOBAR') == -42
         assert ffi.integer_const('FOOBAZ') == -43
         assert ffi.integer_const('k2') == 121212
@@ -164,7 +153,7 @@
         assert p.a[4] == ord('a')
 
     def test_global_var(self):
-        ffi = self.ffi
+        from re_python_pysrc import ffi
         lib = ffi.dlopen(self.extmod)
         assert lib.globalvar42 == 1234
         p = ffi.addressof(lib, 'globalvar42')
@@ -174,25 +163,25 @@
         assert lib.globalvar42 == 1238
 
     def test_global_const_int(self):
-        ffi = self.ffi
+        from re_python_pysrc import ffi
         lib = ffi.dlopen(self.extmod)
         assert lib.globalconst42 == 4321
         raises(AttributeError, ffi.addressof, lib, 'globalconst42')
 
     def test_global_const_nonint(self):
-        ffi = self.ffi
+        from re_python_pysrc import ffi
         lib = ffi.dlopen(self.extmod)
         assert ffi.string(lib.globalconsthello, 8) == "hello"
         raises(AttributeError, ffi.addressof, lib, 'globalconsthello')
 
     def test_rtld_constants(self):
-        ffi = self.ffi
+        from re_python_pysrc import ffi
         ffi.RTLD_NOW    # check that we have the attributes
         ffi.RTLD_LAZY
         ffi.RTLD_GLOBAL
 
     def test_no_such_function_or_global_var(self):
-        ffi = self.ffi
+        from re_python_pysrc import ffi
         lib = ffi.dlopen(self.extmod)
         e = raises(ffi.error, getattr, lib, 'no_such_function')
         assert str(e.value).startswith(


More information about the pypy-commit mailing list