[pypy-svn] r79512 - in pypy/trunk/pypy: . module/cpyext/test

afa at codespeak.net afa at codespeak.net
Thu Nov 25 14:05:52 CET 2010


Author: afa
Date: Thu Nov 25 14:05:50 2010
New Revision: 79512

Modified:
   pypy/trunk/pypy/conftest.py
   pypy/trunk/pypy/module/cpyext/test/test_typeobject.py
Log:
Don't search for memory leaks when the test function is marked with "dont_track_allocations".

Use it in the cpyext module, because I really don't know how to properly deallocate memory there.


Modified: pypy/trunk/pypy/conftest.py
==============================================================================
--- pypy/trunk/pypy/conftest.py	(original)
+++ pypy/trunk/pypy/conftest.py	Thu Nov 25 14:05:50 2010
@@ -336,13 +336,15 @@
         self.runtest_finish()
 
     def runtest_open(self):
-        leakfinder.start_tracking_allocations()
+        if not getattr(self.obj, 'dont_track_allocations', False):
+            leakfinder.start_tracking_allocations()
 
     def runtest_perform(self):
         super(PyPyTestFunction, self).runtest()
 
     def runtest_close(self):
-        if leakfinder.TRACK_ALLOCATIONS:
+        if (not getattr(self.obj, 'dont_track_allocations', False)
+            and leakfinder.TRACK_ALLOCATIONS):
             self._pypytest_leaks = leakfinder.stop_tracking_allocations(False)
         else:            # stop_tracking_allocations() already called
             self._pypytest_leaks = None

Modified: pypy/trunk/pypy/module/cpyext/test/test_typeobject.py
==============================================================================
--- pypy/trunk/pypy/module/cpyext/test/test_typeobject.py	(original)
+++ pypy/trunk/pypy/module/cpyext/test/test_typeobject.py	Thu Nov 25 14:05:50 2010
@@ -206,6 +206,7 @@
         del obj.x
         assert obj.z == prop
 
+    @py.test.mark.dont_track_allocations
     def test_tp_dict(self):
         foo = self.import_module("foo")
         module = self.import_extension('test', [



More information about the Pypy-commit mailing list