| Trees | Indices | Help | 
 | 
|---|
|  | 
  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2006-2014 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 software verification tests. 
 24   
 25  For a description of verification tests, please see U{Wikipedia<https://en.wikipedia.org/wiki/Verification_and_validation_%28software%29>}. 
 26  """ 
 27   
 28  # Python module imports. 
 29  from re import search 
 30  from unittest import TestSuite 
 31   
 32  # relax module imports. 
 33  from lib.errors import RelaxError 
 34   
 35  # relax software verification test module imports. 
 36  from test_suite.relax_test_loader import RelaxTestLoader as TestLoader 
 37  from test_suite.verification_tests.library import Library 
 38  from test_suite.verification_tests.status_object import Status_object 
 39   
 40   
 41  __all__ = [ 
 42      'library', 
 43      'status_object' 
 44  ] 
 45   
 46   
 48      """Class for executing all of the software verification tests.""" 
 49   
 51          """Run the software verification tests. 
 52   
 53          @keyword tests:     The list of system tests to preform. 
 54          @type tests:        list of str 
 55          @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. 
 56          @type runner:       Test runner instance (TextTestRunner, BaseGUITestRunner subclass, etc.) 
 57          """ 
 58   
 59          # Create an array of test suites (add your new TestCase classes here). 
 60          suite_array = [] 
 61   
 62          # Specific tests. 
 63          for test in tests: 
 64              # The entire test class. 
 65              if not search('\.', test): 
 66                  # Check that the class exists. 
 67                  if test not in globals(): 
 68                      raise RelaxError("The system test class '%s' does not exist." % test) 
 69   
 70                  # The uninstantiated class object. 
 71                  obj = globals()[test] 
 72   
 73                  # Add the tests. 
 74                  suite_array.append(TestLoader().loadTestsFromTestCase(obj)) 
 75   
 76              # Single system test. 
 77              else: 
 78                  # Split. 
 79                  row = test.split('.') 
 80   
 81                  # Check. 
 82                  if len(row) != 2: 
 83                      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) 
 84   
 85                  # Unpack. 
 86                  class_name, test_name = row 
 87   
 88                  # Get the class object. 
 89                  obj = globals()[class_name] 
 90   
 91                  # Add the test. 
 92                  suite_array.append(TestLoader().loadTestsFromNames([test_name], obj)) 
 93   
 94          # All tests. 
 95          if not tests: 
 96              suite_array.append(TestLoader().loadTestsFromTestCase(Library)) 
 97              suite_array.append(TestLoader().loadTestsFromTestCase(Status_object)) 
 98   
 99          # Group all tests together. 
100          full_suite = TestSuite(suite_array) 
101   
102          # Run the test suite. 
103          results = runner.run(full_suite) 
104   
105          # Return the status of the tests. 
106          return results.wasSuccessful() 
107   
| Trees | Indices | Help | 
 | 
|---|
| Generated by Epydoc 3.0.1 on Fri Oct 28 15:38:21 2016 | http://epydoc.sourceforge.net |