Author: ronaldoussoren
Date: Wed Apr 1 10:11:17 2009
New Revision: 2129
Log:
Make it possible again to look for memory leaks:
MallocStackLoggingNoCompact=1 PyOBJC_USE_LEAKS=1 python setup.py test
Still need to investigate if the issues that are reported
by such a run are real (at least some of them seem to
be false positive)
Modified:
trunk/pyobjc/pyobjc-core/Lib/PyObjCTools/TestSupport.py
Modified: trunk/pyobjc/pyobjc-core/Lib/PyObjCTools/TestSupport.py
==============================================================================
--- trunk/pyobjc/pyobjc-core/Lib/PyObjCTools/TestSupport.py (original)
+++ trunk/pyobjc/pyobjc-core/Lib/PyObjCTools/TestSupport.py Wed Apr 1 10:11:17 2009
@@ -16,8 +16,7 @@
# Have a way to disable the autorelease pool behaviour
_usepool = not _os.environ.get('PYOBJC_NO_AUTORELEASE')
_useleaks = bool(_os.environ.get('PyOBJC_USE_LEAKS'))
-_useleaks = False
-_leaksVerbose = False
+_leaksVerbose = True
def fourcc(v):
"""
@@ -142,6 +141,11 @@
if not info['retval'].get('c_array_delimited_by_null'):
self.fail(message or "argument %d of %r is not a nul-terminated array"%(argno, method))
+ def failUnlessIsNullTerminated(self, method, message = None):
+ info = method.__metadata__()
+ if not info.get('c_array_delimited_by_null') or not info.get('variadic'):
+ self.fail(message or "%s is not a variadic function with a null-terminated list of arguments"%(method,))
+
def failUnlessArgIsNullTerminated(self, method, argno, message = None):
if isinstance(method, objc.selector):
offset = 2
@@ -419,3 +423,20 @@
print ln
main = _unittest.main
+
+if hasattr(_unittest, 'expectedFailure'):
+ expectedFailure = _unittest.expectedFailure
+else:
+ def expectedFailure(func):
+ def test(self):
+ try:
+ func(self)
+
+ except AssertionError:
+ return
+
+ self.fail("test unexpectedly passed")
+ test.__name__ == func.__name__
+
+ return test
+
------------------------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.