[pypy-svn] r74103 - pypy/branch/cpython-extension/pypy/module/cpyext/test

afa at codespeak.net afa at codespeak.net
Tue Apr 27 10:59:46 CEST 2010


Author: afa
Date: Tue Apr 27 10:59:44 2010
New Revision: 74103

Modified:
   pypy/branch/cpython-extension/pypy/module/cpyext/test/conftest.py
   pypy/branch/cpython-extension/pypy/module/cpyext/test/test_api.py
   pypy/branch/cpython-extension/pypy/module/cpyext/test/test_cpyext.py
Log:
Fix tests: we should have only one object space,
and ensure that the lock object on sys.stdout is created before we count allocations.


Modified: pypy/branch/cpython-extension/pypy/module/cpyext/test/conftest.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/test/conftest.py	(original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/test/conftest.py	Tue Apr 27 10:59:44 2010
@@ -12,7 +12,7 @@
         return super(Directory, self).collect()
 
 def pytest_funcarg__space(request):
-    return gettestobjspace(usemodules=['cpyext'])
+    return gettestobjspace(usemodules=['cpyext', 'thread'])
 
 def pytest_funcarg__api(request):
     return request.cls.api

Modified: pypy/branch/cpython-extension/pypy/module/cpyext/test/test_api.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/test/test_api.py	(original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/test/test_api.py	Tue Apr 27 10:59:44 2010
@@ -17,7 +17,7 @@
 
 class BaseApiTest:
     def setup_class(cls):
-        cls.space = gettestobjspace(usemodules=['cpyext'])
+        cls.space = gettestobjspace(usemodules=['cpyext', 'thread'])
         cls.space.getbuiltinmodule("cpyext")
         class CAPI:
             def __getattr__(self, name):

Modified: pypy/branch/cpython-extension/pypy/module/cpyext/test/test_cpyext.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/test/test_cpyext.py	(original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/test/test_cpyext.py	Tue Apr 27 10:59:44 2010
@@ -195,6 +195,10 @@
     def setup_method(self, func):
         self.w_import_module = self.space.wrap(self.import_module)
         self.w_import_extension = self.space.wrap(self.import_extension)
+
+        # create the file lock before we count allocations
+        self.space.call_method(self.space.sys.get("stdout"), "flush")
+
         freeze_refcnts(self)
         #self.check_and_print_leaks()
 



More information about the Pypy-commit mailing list