Package test_suite :: Package system_tests
[hide private]
[frames] | no frames]

Source Code for Package test_suite.system_tests

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2006-2012 Edward d'Auvergne                                   # 
  4  #                                                                             # 
  5  # This file is part of the program relax.                                     # 
  6  #                                                                             # 
  7  # relax 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 2 of the License, or           # 
 10  # (at your option) any later version.                                         # 
 11  #                                                                             # 
 12  # relax 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 relax; if not, write to the Free Software                        # 
 19  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   # 
 20  #                                                                             # 
 21  ############################################################################### 
 22   
 23  # Package docstring. 
 24  """The relax system/functional tests.""" 
 25   
 26  # Python module imports. 
 27  from relax_errors import RelaxError 
 28  from string import split 
 29  from unittest import TestSuite 
 30   
 31  # relax system/functional test module imports. 
 32  from align_tensor import Align_tensor 
 33  from angles import Angles 
 34  from bmrb import Bmrb 
 35  from bruker import Bruker 
 36  from consistency_tests import Ct 
 37  from dasha import Dasha 
 38  from diffusion_tensor import Diffusion_tensor 
 39  from frame_order import Frame_order 
 40  from generic import Generic 
 41  from grace import Grace 
 42  from jw_mapping import Jw 
 43  from load_spins import Load_spins 
 44  from model_elimination import Modelim 
 45  from model_free import Mf 
 46  from model_selection import Modsel 
 47  from n_state_model import N_state_model 
 48  from noe import Noe 
 49  from noe_restraints import Noe_restraints 
 50  from palmer import Palmer 
 51  from peak_lists import Peak_lists 
 52  from pipes import Pipes 
 53  from rdc import Rdc 
 54  from relax_data import Relax_data 
 55  from relax_fit import Relax_fit 
 56  from results import Results 
 57  from sequence import Sequence 
 58  from state import State 
 59  from structure import Structure 
 60  from test_suite.relax_test_loader import RelaxTestLoader as TestLoader 
 61  from unit_vectors import Unit_vectors 
 62   
 63   
 64  __all__ = ['align_tensor', 
 65             'angles', 
 66             'bmrb', 
 67             'bruker', 
 68             'consistency_tests', 
 69             'dasha' 
 70             'diffusion_tensor', 
 71             'frame_order', 
 72             'generic', 
 73             'grace', 
 74             'jw_mapping', 
 75             'load_spins', 
 76             'model_elimination', 
 77             'model_free', 
 78             'model_selection', 
 79             'n_state_model', 
 80             'noe', 
 81             'noe_restraints', 
 82             'palmer', 
 83             'peak_lists' 
 84             'pipes', 
 85             'rdc', 
 86             'relax_data', 
 87             'relax_fit', 
 88             'results', 
 89             'sequence', 
 90             'state', 
 91             'structure', 
 92             'unit_vectors'] 
 93   
 94   
95 -class System_test_runner:
96 """Class for executing all of the system/functional tests.""" 97
98 - def run(self, tests=None, runner=None):
99 """Run the system/functional tests. 100 101 The system 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. 102 103 104 @keyword tests: The list of system tests to preform. 105 @type tests: list of str 106 @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. 107 @type runner: Test runner instance (TextTestRunner, BaseGUITestRunner subclass, etc.) 108 """ 109 110 # Create an array of test suites (add your new TestCase classes here). 111 suite_array = [] 112 113 # Specific tests. 114 for test in tests: 115 # Split. 116 row = split(test, '.') 117 118 # Check. 119 if len(row) != 2: 120 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) 121 122 # Unpack. 123 class_name, test_name = row 124 125 # Get the class object. 126 obj = globals()[class_name] 127 128 # Add the test. 129 suite_array.append(TestLoader().loadTestsFromNames([test_name], obj)) 130 131 # All tests. 132 if not tests: 133 suite_array.append(TestLoader().loadTestsFromTestCase(Align_tensor)) 134 suite_array.append(TestLoader().loadTestsFromTestCase(Bmrb)) 135 suite_array.append(TestLoader().loadTestsFromTestCase(Bruker)) 136 suite_array.append(TestLoader().loadTestsFromTestCase(Angles)) 137 suite_array.append(TestLoader().loadTestsFromTestCase(Ct)) 138 suite_array.append(TestLoader().loadTestsFromTestCase(Dasha)) 139 suite_array.append(TestLoader().loadTestsFromTestCase(Diffusion_tensor)) 140 suite_array.append(TestLoader().loadTestsFromTestCase(Frame_order)) 141 suite_array.append(TestLoader().loadTestsFromTestCase(Generic)) 142 suite_array.append(TestLoader().loadTestsFromTestCase(Grace)) 143 suite_array.append(TestLoader().loadTestsFromTestCase(Jw)) 144 suite_array.append(TestLoader().loadTestsFromTestCase(Load_spins)) 145 suite_array.append(TestLoader().loadTestsFromTestCase(Modelim)) 146 suite_array.append(TestLoader().loadTestsFromTestCase(Mf)) 147 suite_array.append(TestLoader().loadTestsFromTestCase(Modsel)) 148 suite_array.append(TestLoader().loadTestsFromTestCase(N_state_model)) 149 suite_array.append(TestLoader().loadTestsFromTestCase(Noe)) 150 suite_array.append(TestLoader().loadTestsFromTestCase(Noe_restraints)) 151 suite_array.append(TestLoader().loadTestsFromTestCase(Palmer)) 152 suite_array.append(TestLoader().loadTestsFromTestCase(Peak_lists)) 153 suite_array.append(TestLoader().loadTestsFromTestCase(Pipes)) 154 suite_array.append(TestLoader().loadTestsFromTestCase(Rdc)) 155 suite_array.append(TestLoader().loadTestsFromTestCase(Relax_data)) 156 suite_array.append(TestLoader().loadTestsFromTestCase(Relax_fit)) 157 suite_array.append(TestLoader().loadTestsFromTestCase(Results)) 158 suite_array.append(TestLoader().loadTestsFromTestCase(Sequence)) 159 suite_array.append(TestLoader().loadTestsFromTestCase(State)) 160 suite_array.append(TestLoader().loadTestsFromTestCase(Structure)) 161 suite_array.append(TestLoader().loadTestsFromTestCase(Unit_vectors)) 162 163 # Group all tests together. 164 full_suite = TestSuite(suite_array) 165 166 # Run the test suite. 167 results = runner.run(full_suite) 168 169 # Return the status of the tests. 170 return results.wasSuccessful()
171