Linux integration tests: Fix crash if there is no session D-BUS

This can happen in CI environments without a desktop session.
This commit is contained in:
Martin Pitt 2014-09-02 15:57:09 +02:00
parent 0b50cef90c
commit e5bd3e80f3

View file

@ -81,7 +81,10 @@ class Tests(unittest.TestCase):
# set up a fake system D-BUS
cls.test_bus = Gio.TestDBus.new(Gio.TestDBusFlags.NONE)
cls.test_bus.up()
del os.environ['DBUS_SESSION_BUS_ADDRESS']
try:
del os.environ['DBUS_SESSION_BUS_ADDRESS']
except KeyError:
pass
os.environ['DBUS_SYSTEM_BUS_ADDRESS'] = cls.test_bus.get_bus_address()
cls.dbus = Gio.bus_get_sync(Gio.BusType.SYSTEM, None)