Author: Ronan Lamy <[email protected]>
Branch: test-cpyext
Changeset: r87481:cba31dbe2060
Date: 2016-10-01 01:32 +0100
http://bitbucket.org/pypy/pypy/changeset/cba31dbe2060/

Log:    Create sys_info in setup_class() instead of setup_method()

diff --git a/pypy/module/cpyext/test/test_cpyext.py 
b/pypy/module/cpyext/test/test_cpyext.py
--- a/pypy/module/cpyext/test/test_cpyext.py
+++ b/pypy/module/cpyext/test/test_cpyext.py
@@ -390,6 +390,7 @@
         space = cls.space
         cls.w_here = space.wrap(str(HERE))
         if not cls.runappdirect:
+            cls.sys_info = get_cpyext_info(space)
             cls.w_runappdirect = space.wrap(cls.runappdirect)
             space.getbuiltinmodule("cpyext")
             # 'import os' to warm up reference counts
@@ -398,6 +399,8 @@
             #state = cls.space.fromcache(RefcountState) ZZZ
             #state.non_heaptypes_w[:] = []
             cls.w_debug_collect = space.wrap(interp2app(debug_collect))
+        else:
+            cls.sys_info = get_sys_info_app()
 
     def record_imported_module(self, name):
         """
@@ -468,14 +471,12 @@
         self.imported_module_names = []
 
         if self.runappdirect:
-            self.sys_info = get_sys_info_app()
             self.compile_module = self.sys_info.compile_extension_module
             self.load_module = self.sys_info.load_module
             self.import_module = self.sys_info.import_module
             self.import_extension = self.sys_info.import_extension
         else:
             wrap = self.space.wrap
-            self.sys_info = get_cpyext_info(self.space)
             self.w_compile_module = wrap(interp2app(compile_module))
             self.w_load_module = wrap(interp2app(load_module))
             self.w_import_module = wrap(interp2app(import_module))
diff --git a/pypy/module/cpyext/test/test_pyfile.py 
b/pypy/module/cpyext/test/test_pyfile.py
--- a/pypy/module/cpyext/test/test_pyfile.py
+++ b/pypy/module/cpyext/test/test_pyfile.py
@@ -101,7 +101,7 @@
         w_stdout = space.sys.get("stdout")
         assert api.PyFile_SoftSpace(w_stdout, 1) == 0
         assert api.PyFile_SoftSpace(w_stdout, 0) == 1
-        
+
         api.PyFile_SoftSpace(w_stdout, 1)
         w_ns = space.newdict()
         space.exec_("print 1,", w_ns, w_ns)
@@ -117,11 +117,9 @@
 class AppTestPyFile(AppTestCpythonExtensionBase):
 
     def setup_class(cls):
+        AppTestCpythonExtensionBase.setup_class.__func__(cls)
         from rpython.tool.udir import udir
-        if option.runappdirect:
-            cls.w_udir = str(udir)
-        else:
-            cls.w_udir = cls.space.wrap(str(udir))
+        cls.w_udir = cls.space.wrap(str(udir))
 
     def test_file_tell(self):
         module = self.import_extension('foo', [
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to