6 from random import randint
8 def runTestApp(module_name, dbus_name=None):
10 from subprocess import Popen
12 test_data_directory = os.environ["TEST_DATA_DIRECTORY"]
13 test_modules_directory = os.environ["TEST_MODULES_DIRECTORY"]
14 test_atspi_library = os.environ["TEST_ATSPI_LIBRARY"]
15 test_application = os.environ["TEST_APPLICATION"]
17 test_module = os.path.join(test_modules_directory, module_name)
20 print " ".join([test_application,
21 "--atspi-dbus-name", dbus_name,
22 "--test-atspi-library", test_atspi_library,
23 "--test-module", test_module,
24 "--test-data-directory", test_data_directory,])
25 pop = Popen([test_application,
26 "--atspi-dbus-name", dbus_name,
27 "--test-atspi-library", test_atspi_library,
28 "--test-module", test_module,
29 "--test-data-directory", test_data_directory,])
31 print " ".join([test_application,
32 "--test-atspi-library", test_atspi_library,
33 "--test-module", test_module,
34 "--test-data-directory", test_data_directory,])
35 pop = Popen([test_application,
36 "--test-atspi-library", test_atspi_library,
37 "--test-module", test_module,
38 "--test-data-directory", test_data_directory,])
41 The test application %s has been started with PID %d.
43 To continue the test press ENTER.\n\n
45 if ("TEST_APP_WAIT_FOR_DEBUG" in os.environ.keys()):
46 raw_input(wait_message % (module_name, pop.pid))
51 # TODO Modify this function to add registryd as an option
52 bus = dbus.SessionBus()
53 name = "test.atspi.R" + str(randint(1, 1000))
55 app = runTestApp(testModule, name)
56 # Wait a little time for the app to start up
57 # TODO connect this up to the apps start signal
60 to = bus.get_object(name, "/org/codethink/atspi/test")
61 test = dbus.Interface(to, "org.codethink.atspi.test")
63 # Run the test script here FIXME
65 # Inform the test app it can shut down.
68 if __name__=="__main__":
69 sys.exit(main(sys.argv))