summaryrefslogtreecommitdiff
path: root/tests
diff options
authorThomi Richards <thomi.richards@canonical.com>2012-07-27 08:50:24 +1200
committerThomi Richards <thomi.richards@canonical.com>2012-07-27 08:50:24 +1200
commitfacb407f5211bc6857cb01af737bb86607b8211b (patch)
tree2c51cf839b7e1b1eedc42827388e84397811eb12 /tests
parentf1ff23f01b6f8f6575132611677d0e1faebb4252 (diff)
Don't cache the unity debug logging dbus interface, so if unity crashes and comes back we can continue the test run.
(bzr r2521.1.1)
Diffstat (limited to 'tests')
-rw-r--r--tests/autopilot/unity/emulators/unity.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/tests/autopilot/unity/emulators/unity.py b/tests/autopilot/unity/emulators/unity.py
index 69ecab582..97b1840a0 100644
--- a/tests/autopilot/unity/emulators/unity.py
+++ b/tests/autopilot/unity/emulators/unity.py
@@ -18,17 +18,22 @@ DEBUG_PATH = '/com/canonical/Unity/Debug'
LOGGING_IFACE = 'com.canonical.Unity.Debug.Logging'
-_debug_proxy_obj = session_bus.get_object(UNITY_BUS_NAME, DEBUG_PATH)
-_logging_iface = Interface(_debug_proxy_obj, LOGGING_IFACE)
+def get_dbus_proxy_object():
+ return session_bus.get_object(UNITY_BUS_NAME, DEBUG_PATH)
+
+
+def get_dbus_logging_interface():
+ return Interface(get_dbus_proxy_object(), LOGGING_IFACE)
+
def start_log_to_file(file_path):
"""Instruct Unity to start logging to the given file."""
- _logging_iface.StartLogToFile(file_path)
+ get_dbus_logging_interface().StartLogToFile(file_path)
def reset_logging():
"""Instruct Unity to stop logging to a file."""
- _logging_iface.ResetLogging()
+ get_dbus_logging_interface().ResetLogging()
def set_log_severity(component, severity):
@@ -39,7 +44,7 @@ def set_log_severity(component, severity):
'severity' is the severity name (like 'DEBUG', 'INFO' etc.)
"""
- _logging_iface.SetLogSeverity(component, severity)
+ get_dbus_logging_interface().SetLogSeverity(component, severity)
def log_unity_message(severity, message):
@@ -53,5 +58,5 @@ def log_unity_message(severity, message):
test, use the python logging framework instead.
"""
- _logging_iface.LogMessage(severity, message)
+ get_dbus_logging_interface().LogMessage(severity, message)