[conduit: 92/138] Run a dbus-monitor for each test, capture output



commit 5f5553578bd94531d97244fc31c8468343255b4b
Author: John Carr <john carr unrouted co uk>
Date:   Tue May 5 01:29:40 2009 -0700

    Run a dbus-monitor for each test, capture output
---
 test/soup/env/fake-dbus.py |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/test/soup/env/fake-dbus.py b/test/soup/env/fake-dbus.py
index aa6fd19..a50924b 100644
--- a/test/soup/env/fake-dbus.py
+++ b/test/soup/env/fake-dbus.py
@@ -2,6 +2,7 @@
 import os
 import signal
 import subprocess
+import tempfile
 
 import soup
 
@@ -29,6 +30,18 @@ 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 _(*args, **kwargs):
+            fd, f = tempfile.mkstemp()
+            os.close(fd)
+            p = subprocess.Popen("dbus-monitor &> %s" % f, shell=True)
+            test(*args, **kwargs)
+            os.kill(p.pid, signal.SIGINT)
+            # FIXME: Need some way to attach data to a test
+            # print open(f).read()
+            os.unlink(f)
+        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]