Update of /cvsroot/pywin32/pywin32/com/win32com/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8851
Modified Files:
testPippo.py
Log Message:
Test pippo correctly exposes its type info at runtime.
Index: testPippo.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testPippo.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** testPippo.py 22 Apr 2004 08:24:00 -0000 1.1
--- testPippo.py 7 Sep 2004 02:10:13 -0000 1.2
***************
*** 3,6 ****
--- 3,7 ----
import pythoncom
from win32com.client import Dispatch
+ from win32com.client.gencache import EnsureDispatch
class PippoTester(unittest.TestCase):
***************
*** 19,23 ****
except AttributeError:
print "Please run this with python_d for leak tests"
! return
# note creating self.object() should have consumed our "one time" leaks
self.object.Method1()
--- 20,24 ----
except AttributeError:
print "Please run this with python_d for leak tests"
! gtrc = lambda: 0
# note creating self.object() should have consumed our "one time" leaks
self.object.Method1()
***************
*** 30,33 ****
--- 31,52 ----
if end-start > 5:
self.fail("We lost %d references!" % (end-start,))
+
+ def testLeaksGencache(self):
+ try:
+ gtrc = sys.gettotalrefcount
+ except AttributeError:
+ print "Please run this with python_d for leak tests"
+ gtrc = lambda: 0
+ # note creating self.object() should have consumed our "one time" leaks
+ object = EnsureDispatch("Python.Test.Pippo")
+ start = gtrc()
+ for i in range(1000):
+ object = EnsureDispatch("Python.Test.Pippo")
+ object.Method1()
+ object = None
+ end = gtrc()
+ if end-start > 10:
+ self.fail("We lost %d references!" % (end-start,))
+
if __name__=='__main__':
unittest.main()
|