summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2013-01-24 16:54:05 +0100
committerBastien Nocera <hadess@hadess.net>2013-01-24 18:05:24 +0100
commitc97c65b42aced616488ec66800e93be21635ae75 (patch)
treebb06312cb3b0122179d0c183f9f30a980513b87b /tests
parent16a32d5e87b6db6a499be5309fe466ad809f4274 (diff)
downloadgnome-settings-daemon-c97c65b42aced616488ec66800e93be21635ae75.tar.gz
tests: Add dbus-monitor logging
Diffstat (limited to 'tests')
-rw-r--r--tests/gsdtestcase.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/gsdtestcase.py b/tests/gsdtestcase.py
index 3dd902e1..09478056 100644
--- a/tests/gsdtestcase.py
+++ b/tests/gsdtestcase.py
@@ -80,6 +80,7 @@ class GSDTestCase(dbusmock.DBusTestCase):
set_nonblock(klass.p_notify.stdout)
klass.start_session()
+ klass.start_monitor()
klass.settings_session = Gio.Settings('org.gnome.desktop.session')
@@ -87,6 +88,7 @@ class GSDTestCase(dbusmock.DBusTestCase):
def tearDownClass(klass):
klass.p_notify.terminate()
klass.p_notify.wait()
+ klass.stop_monitor()
klass.stop_session()
dbusmock.DBusTestCase.tearDownClass()
klass.stop_xorg()
@@ -157,6 +159,28 @@ class GSDTestCase(dbusmock.DBusTestCase):
klass.session_log.flush()
klass.session_log.close()
+ @classmethod
+ def start_monitor(klass):
+ '''Start dbus-monitor'''
+
+ # You can rename the log file to *.log if you want to see it on test
+ # case failures
+ klass.monitor_log = open(os.path.join(klass.workdir, 'dbus-monitor.out'), 'wb')
+ klass.monitor = subprocess.Popen(['dbus-monitor', '--monitor'],
+ stdout=klass.monitor_log,
+ stderr=subprocess.STDOUT)
+
+ @classmethod
+ def stop_monitor(klass):
+ '''Stop dbus-monitor'''
+
+ assert klass.monitor
+ klass.monitor.terminate()
+ klass.monitor.wait()
+
+ klass.monitor_log.flush()
+ klass.monitor_log.close()
+
def start_logind(self):
'''start mock logind'''