2008-06-02 Mark Doffman <mark.doffman@codethink.co.uk>
[platform/core/uifw/at-spi2-atk.git] / tests / testrunner.py
1 import sys
2 import unittest
3 import clients
4
5 from optparse import OptionParser
6
7 parser = OptionParser()
8 parser.add_option("-d", "--testdata", dest="testdata", help="Location of test data directory")
9 parser.add_option("-a", "--atspilib", dest="atspilib", help="Location of atk to atspi adaptor")
10 parser.add_option("-t", "--testmodules", dest="testmodules", help="Location of test application libraries")
11 parser.add_option("-r", "--testapp", dest="testapp", help="Location of test application executable")
12 parser.add_option("-b", "--busname", dest="busname", help="D-Bus name of test application")
13 parser.add_option("-o", "--objectpath", dest="objectpath", help="Object path of test applicaiton tree interface")
14
15 optionvars = ["testdata",
16                 "atspilib",
17                 "testmodules",
18                 "testapp",
19                 "busname",
20                 "objectpath"]
21
22 def set_data(options, name):
23         val = getattr(options, name)
24         if val is not None:
25                 setattr(clients.testutil, name, val)
26
27 def main(argv):
28         (options, args) = parser.parse_args()
29         [set_data(options, name) for name in optionvars]
30
31         runner = unittest.TextTestRunner()
32         testsuite = unittest.defaultTestLoader.loadTestsFromModule(clients)
33         runner.run(testsuite)
34
35 if __name__=="__main__":
36         sys.exit(main(sys.argv))