[telepathy-mission-control/master] servicetest: add a way to clean up circular references among simulated objects

Simon McVittie simon.mcvittie at collabora.co.uk
Wed Apr 1 09:55:17 PDT 2009


---
 test/twisted/servicetest.py |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/test/twisted/servicetest.py b/test/twisted/servicetest.py
index 20036c8..41b9175 100644
--- a/test/twisted/servicetest.py
+++ b/test/twisted/servicetest.py
@@ -345,7 +345,14 @@ class IteratingEventQueue(BaseEventQueue):
     def attach_to_bus(self, bus):
         assert self._bus is None, self._bus
         self._bus = bus
-        self._bus.add_message_filter(self._dbus_filter)
+        self._dbus_filter_bound_method = self._dbus_filter
+        self._bus.add_message_filter(self._dbus_filter_bound_method)
+
+    def cleanup(self):
+        if self._bus is not None:
+            self._bus.remove_message_filter(self._dbus_filter_bound_method)
+            self._bus = None
+        self._dbus_method_impls = []
 
     def _dbus_filter(self, bus, message):
         if isinstance(message, dbus.lowlevel.MethodCallMessage):
-- 
1.5.6.5




More information about the telepathy-commits mailing list