Trees | Indices | Help |
|
---|
|
1 ############################################################################### 2 # # 3 # Copyright (C) 2006,2008-2012,2019 Edward d'Auvergne # 4 # # 5 # This file is part of the program relax (http://www.nmr-relax.com). # 6 # # 7 # This program is free software: you can redistribute it and/or modify # 8 # it under the terms of the GNU General Public License as published by # 9 # the Free Software Foundation, either version 3 of the License, or # 10 # (at your option) any later version. # 11 # # 12 # This program is distributed in the hope that it will be useful, # 13 # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 # GNU General Public License for more details. # 16 # # 17 # You should have received a copy of the GNU General Public License # 18 # along with this program. If not, see <http://www.gnu.org/licenses/>. # 19 # # 20 ############################################################################### 21 22 # Package docstring. 23 """The relax GUI tests.""" 24 25 # Python module imports. 26 from re import search 27 from unittest import TestSuite 28 import wx 29 30 # relax module imports. 31 from lib.errors import RelaxError 32 33 # relax GUI test module imports. 34 from test_suite.formatting import format_test_name 35 from test_suite.gui_tests.bmrb import Bmrb 36 from test_suite.gui_tests.bruker import Bruker 37 from test_suite.gui_tests.consistency_tests import Ct 38 from test_suite.gui_tests.dead_uf_pages import Dead_uf_pages 39 from test_suite.gui_tests.frame_order import Frame_order 40 from test_suite.gui_tests.general import General 41 from test_suite.gui_tests.interatomic import Interatomic 42 from test_suite.gui_tests.jw_mapping import Jw_mapping 43 from test_suite.gui_tests.model_free import Mf 44 from test_suite.gui_tests.n_state_model import N_state_model 45 from test_suite.gui_tests.noe import Noe 46 from test_suite.gui_tests.pipes import Pipes 47 from test_suite.gui_tests.relax_disp import Relax_disp 48 from test_suite.gui_tests.rx import Rx 49 from test_suite.gui_tests.state import State 50 from test_suite.gui_tests.test_user_functions import User_functions 51 from test_suite.relax_test_loader import RelaxTestLoader as TestLoader 52 53 54 __all__ = ['bmrb', 55 'consistency_tests', 56 'gui', 57 'interatomic', 58 'jw_mapping', 59 'model_free', 60 'n_state_model', 61 'noe', 62 'pipes', 63 'rx', 64 'state'] 65 6668 """Class for executing all of the GUI tests.""" 6915371 """Run the GUI tests. 72 73 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. 74 75 76 @keyword tests: The list of GUI tests to preform. 77 @type tests: list of str 78 @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. 79 @type runner: Test runner instance (TextTestRunner, BaseGUITestRunner subclass, etc.) 80 @keyword list_tests: A flag which if True will cause the tests to be listed rather than executed. 81 @type list_tests: bool 82 """ 83 84 # Create an array of test suites (add your new TestCase classes here). 85 suite_array = [] 86 87 # Specific tests. 88 for test in tests: 89 # The entire test class. 90 if not search(r'\.', test): 91 # Check that the class exists. 92 if test not in globals(): 93 raise RelaxError("The GUI test class '%s' does not exist." % test) 94 95 # The uninstantiated class object. 96 obj = globals()[test] 97 98 # Add the tests. 99 suite_array.append(TestLoader().loadTestsFromTestCase(obj)) 100 101 # Single system test. 102 else: 103 # Split. 104 row = test.split('.') 105 106 # Check. 107 if len(row) != 2: 108 raise RelaxError("The GUI test '%s' is not in the correct format. It should consist of the test case class, a dot, and the specific test." % test) 109 110 # Unpack. 111 class_name, test_name = row 112 113 # Get the class object. 114 obj = globals()[class_name] 115 116 # Add the test. 117 suite_array.append(TestLoader().loadTestsFromNames([test_name], obj)) 118 119 # All tests. 120 if not tests: 121 suite_array.append(TestLoader().loadTestsFromTestCase(Bmrb)) 122 suite_array.append(TestLoader().loadTestsFromTestCase(Bruker)) 123 suite_array.append(TestLoader().loadTestsFromTestCase(Ct)) 124 suite_array.append(TestLoader().loadTestsFromTestCase(Dead_uf_pages)) 125 suite_array.append(TestLoader().loadTestsFromTestCase(Frame_order)) 126 suite_array.append(TestLoader().loadTestsFromTestCase(General)) 127 suite_array.append(TestLoader().loadTestsFromTestCase(Interatomic)) 128 suite_array.append(TestLoader().loadTestsFromTestCase(Jw_mapping)) 129 suite_array.append(TestLoader().loadTestsFromTestCase(Mf)) 130 suite_array.append(TestLoader().loadTestsFromTestCase(N_state_model)) 131 suite_array.append(TestLoader().loadTestsFromTestCase(Noe)) 132 suite_array.append(TestLoader().loadTestsFromTestCase(Pipes)) 133 suite_array.append(TestLoader().loadTestsFromTestCase(Relax_disp)) 134 suite_array.append(TestLoader().loadTestsFromTestCase(Rx)) 135 suite_array.append(TestLoader().loadTestsFromTestCase(State)) 136 suite_array.append(TestLoader().loadTestsFromTestCase(User_functions)) 137 138 # Group all tests together. 139 full_suite = TestSuite(suite_array) 140 141 # Only list the tests. 142 if list_tests: 143 for suite in full_suite._tests: 144 for test in suite: 145 print(format_test_name(test.id())) 146 return True 147 148 # Run the test suite. 149 results = runner.run(full_suite) 150 151 # Return the status of the tests. 152 return results.wasSuccessful()
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sat Jun 8 10:45:35 2024 | http://epydoc.sourceforge.net |