Run the session bus test if the session bus env var is set

This commit is contained in:
Kovid Goyal 2016-07-03 15:13:07 +05:30
parent b9c1dbb33f
commit 4745bdabe3

View File

@ -32,12 +32,14 @@ class BuildTest(unittest.TestCase):
@unittest.skipUnless(islinux, 'DBUS only used on linux')
def test_dbus(self):
import dbus
bus = None
if 'DISPLAY' in os.environ:
bus = dbus.SystemBus()
self.assertTrue(bus.list_names(), 'Failed to list names on the system bus')
if 'DBUS_SESSION_BUS_ADDRESS' in os.environ:
bus = dbus.SessionBus()
self.assertTrue(bus.list_names(), 'Failed to list names on the session bus')
del bus
del bus
def test_regex(self):
import regex