1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 """The relax GUI tests."""
25
26
27 from relax_errors import RelaxError
28 from string import split
29 from unittest import TestSuite
30
31
32 from bmrb import Bmrb
33 from model_free import Mf
34 from noe import Noe
35 from rx import Rx
36 from state import State
37 from test_suite.relax_test_loader import RelaxTestLoader as TestLoader
38
39
40 __all__ = ['bmrb',
41 'model_free',
42 'noe',
43 'rx',
44 'state']
45
46
48 """Class for executing all of the GUI tests."""
49
50 - def run(self, tests=None, runner=None):
51 """Run the GUI tests.
52
53 The GUI test list should be something like ['N_state_model.test_stereochem_analysis']. The first part is the imported test case class, the second is the specific test.
54
55
56 @keyword tests: The list of GUI tests to preform.
57 @type tests: list of str
58 @keyword runner: A test runner such as TextTestRunner. For an example of how to write a test runner see the python documentation for TextTestRunner in the python source.
59 @type runner: Test runner instance (TextTestRunner, BaseGUITestRunner subclass, etc.)
60 """
61
62
63 suite_array = []
64
65
66 for test in tests:
67
68 row = split(test, '.')
69
70
71 if len(row) != 2:
72 raise RelaxError("The test '%s' is not in the correct format. It should consist of the test case class, a dot, and the specific test." % test)
73
74
75 class_name, test_name = row
76
77
78 obj = globals()[class_name]
79
80
81 suite_array.append(TestLoader().loadTestsFromNames([test_name], obj))
82
83
84 if not tests:
85 suite_array.append(TestLoader().loadTestsFromTestCase(Bmrb))
86 suite_array.append(TestLoader().loadTestsFromTestCase(Mf))
87 suite_array.append(TestLoader().loadTestsFromTestCase(Noe))
88 suite_array.append(TestLoader().loadTestsFromTestCase(Rx))
89 suite_array.append(TestLoader().loadTestsFromTestCase(State))
90
91
92 full_suite = TestSuite(suite_array)
93
94
95 results = runner.run(full_suite)
96
97
98 return results.wasSuccessful()
99