7 from dbus.mainloop.glib import DBusGMainLoop
9 from accessible_cache import AccessibleCache
10 from random import randint
14 class CoreTestCase(unittest.TestCase):
16 DBusGMainLoop(set_as_default=True)
18 self._bus = dbus.SessionBus()
19 self._loop = gobject.MainLoop()
20 self._name = "test.atspi.R" + str(randint(1, 1000))
21 self._match = self._bus.add_signal_receiver(self.post_application_setup,
23 "org.codethink.atspi.test",
27 if "TEST_APP_WAIT_FOR_DEBUG" not in os.environ.keys():
28 gobject.timeout_add(1000, self.application_check)
31 #Shut down the test application
40 def application_check(self):
42 self.fail("Test application did not start")
44 def post_application_setup(self):
47 self._cache = AccessibleCache(self._bus, self._name, "/org/freedesktop/atspi/tree")
49 test_object = self._bus.get_object(self._name, "/org/codethink/atspi/test")
50 self._test = dbus.Interface(test_object, "org.codethink.atspi.test")
52 self.post_application_test()
56 def post_application_test(self):
57 raise Exception, "No test has been defined"