diff options
author | Siegfried-Angel Gevatter Pujals <siegfried@gevatter.com> | 2012-02-07 23:13:29 +0100 |
---|---|---|
committer | Siegfried-Angel Gevatter Pujals <siegfried@gevatter.com> | 2012-02-07 23:13:29 +0100 |
commit | 74be4e3c8cef56e1eae1683f3f84efb5afcf2799 (patch) | |
tree | e19bbc71757e52ad784c2bef0413f171f3adde41 /python | |
parent | 99eac2e168eafd8026322696b37cd0e00cef0744 (diff) | |
download | zeitgeist-74be4e3c8cef56e1eae1683f3f84efb5afcf2799.tar.gz |
Make bus initialization lazy so tests connect to the correct D-Bus instance
Diffstat (limited to 'python')
-rw-r--r-- | python/client.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/python/client.py b/python/client.py index df54779b..9217979e 100644 --- a/python/client.py +++ b/python/client.py @@ -40,10 +40,14 @@ SIG_EVENT = "asaasay" log = logging.getLogger("zeitgeist.client") -# This is here so testutils.py can override it with a private bus connection +# This is here so testutils.py can override it with a private bus connection. +# Init needs to be lazy so tests will use the private D-Bus instance. global session_bus -session_bus = dbus.SessionBus() +session_bus = None def get_bus(): + global session_bus + if session_bus is None: + session_bus = dbus.SessionBus() return session_bus def _set_bus(bus): global session_bus |