[pypy-svn] pypy simplify-conftest: Only test for leaks when the test actually passed

amauryfa commits-noreply at bitbucket.org
Mon Jan 10 19:59:04 CET 2011


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: simplify-conftest
Changeset: r40565:b7ed7b358972
Date: 2011-01-10 19:58 +0100
http://bitbucket.org/pypy/pypy/changeset/b7ed7b358972/

Log:	Only test for leaks when the test actually passed

diff --git a/pypy/conftest.py b/pypy/conftest.py
--- a/pypy/conftest.py
+++ b/pypy/conftest.py
@@ -330,6 +330,10 @@
         if not getattr(item.obj, 'dont_track_allocations', False):
             leakfinder.start_tracking_allocations()
 
+def pytest_runtest_call(__multicall__, item):
+    __multicall__.execute()
+    item._success = True
+
 def pytest_runtest_teardown(__multicall__, item):
     __multicall__.execute()
 
@@ -341,7 +345,7 @@
             item._pypytest_leaks = None
 
         # check for leaks, but only if the test passed so far
-        if item._pypytest_leaks:
+        if getattr(item, '_success', False) and item._pypytest_leaks:
             raise leakfinder.MallocMismatch(item._pypytest_leaks)
 
     if 'pygame' in sys.modules:


More information about the Pypy-commit mailing list