summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2007-11-23 13:40:03 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2007-11-23 13:40:03 +0100
commit3dc72516fe915b5ba3722b11e07fb70211169509 (patch)
treed45474126b6a9bad8c1c1bdf276df186d04ec58f /tests
parent14eafeeba30ccb31676769d708ad0aa681fab219 (diff)
downloadpython-apt-3dc72516fe915b5ba3722b11e07fb70211169509.tar.gz
* python/progress.cc:
- fix refcount problem in OpProgress - fix refcount problem in FetchProgress - fix refcount problem in CdromProgress
Diffstat (limited to 'tests')
-rwxr-xr-xtests/refcount.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/refcount.py b/tests/refcount.py
new file mode 100755
index 00000000..e8bd9c6d
--- /dev/null
+++ b/tests/refcount.py
@@ -0,0 +1,35 @@
+#!/usr/bin/python-dbg
+
+from pprint import pprint,pformat
+import apt
+import sys
+import gc
+import difflib
+
+# get initial cache
+print sys.gettotalrefcount()
+progress= apt.progress.OpTextProgress()
+c = apt.Cache(progress)
+print "refcount after first cache instance: ", sys.gettotalrefcount()
+
+# test open()
+c.open(progress)
+print "refcount after cache open: ", sys.gettotalrefcount()
+#pprint(sys.getobjects(10))
+
+c.open(apt.progress.OpProgress())
+print "refcount after seconf cache open: ", sys.gettotalrefcount()
+#pprint(sys.getobjects(10))
+
+# FIXME: find a way to get a efficient diff
+#before = gc.get_objects()
+#c.open(apt.progress.OpProgress())
+#after = gc.get_objects()
+
+
+# test update()
+print "refcount before cache.update(): ", sys.gettotalrefcount()
+c.update()
+gc.collect()
+print "refcount after cache.update(): ", sys.gettotalrefcount()
+pprint(sys.getobjects(20))