[conduit: 134/138] Monitor logs slow things down, so break it out of the other dbus code. Needs priority stuff :( :(



commit 6e3c0d1180d47424e654b480c316c6e6edbc9076
Author: John Carr <john carr unrouted co uk>
Date:   Thu May 7 03:01:51 2009 -0700

    Monitor logs slow things down, so break it out of the other dbus code. Needs priority stuff :( :(
---
 test/soup/env/dbus-monitor.py |   24 ++++++++++++++++++++++++
 test/soup/env/fake-dbus.py    |   15 ---------------
 2 files changed, 24 insertions(+), 15 deletions(-)

diff --git a/test/soup/env/dbus-monitor.py b/test/soup/env/dbus-monitor.py
new file mode 100644
index 0000000..cb38c8c
--- /dev/null
+++ b/test/soup/env/dbus-monitor.py
@@ -0,0 +1,24 @@
+
+import os
+import signal
+import subprocess
+import tempfile
+
+import soup
+
+class DbusMonitor(soup.env.EnvironmentWrapper):
+
+    @classmethod
+    def enabled(cls, opts):
+        return False
+
+    def decorate_test(self, test):
+        def _(result, *args, **kwargs):
+            logfile = tempfile.TemporaryFile()
+            p = subprocess.Popen("dbus-monitor", stdout=logfile, stderr=subprocess.STDOUT, close_fds=True)
+            test(result, *args, **kwargs)
+            os.kill(p.pid, signal.SIGINT)
+            logfile.seek(0)
+            result.addAttachment(test, "D-Bus Monitor logs", logfile.read())
+        return _
+
diff --git a/test/soup/env/fake-dbus.py b/test/soup/env/fake-dbus.py
index c73bf6f..6664ee0 100644
--- a/test/soup/env/fake-dbus.py
+++ b/test/soup/env/fake-dbus.py
@@ -2,14 +2,9 @@
 import os
 import signal
 import subprocess
-import tempfile
 
 import soup
 
-# FIXME: Something somewhere is causing us to poke libdbus into looking at DBUS_SESSION_BUS_ADDRESS early
-# The official answer is that soup is evil :'(
-# 1. Envrionment code should run as early as possible (before test loader)
-# 2. Should avoid doing too much crack on import :/
 
 class Dbus(soup.env.EnvironmentWrapper):
 
@@ -39,16 +34,6 @@ class Dbus(soup.env.EnvironmentWrapper):
         # lets use this session bus when we run tests
         os.environ['DBUS_SESSION_BUS_ADDRESS'] = self.address
 
-    def decorate_test(self, test):
-        def _(result, *args, **kwargs):
-            logfile = tempfile.TemporaryFile()
-            p = subprocess.Popen("dbus-monitor", stdout=logfile, stderr=subprocess.STDOUT, close_fds=True)
-            test(result, *args, **kwargs)
-            os.kill(p.pid, signal.SIGINT)
-            logfile.seek(0)
-            result.addAttachment(test, "D-Bus Monitor logs", logfile.read())
-        return _
-
     def finalize_environment(self):
         os.kill(int(self.pid), signal.SIGINT)
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]