Author: bugman Date: Tue May 22 14:03:27 2012 New Revision: 16385 URL: http://svn.gna.org/viewcvs/relax?rev=16385&view=rev Log: Modified the GUI tests so that they can operate in the same way as the system tests. Now entire test suite classes can be executed in isolation by typing, for example: $ relax --gui-test N_state_model Modified: branches/uf_redesign/test_suite/gui_tests/__init__.py Modified: branches/uf_redesign/test_suite/gui_tests/__init__.py URL: http://svn.gna.org/viewcvs/relax/branches/uf_redesign/test_suite/gui_tests/__init__.py?rev=16385&r1=16384&r2=16385&view=diff ============================================================================== --- branches/uf_redesign/test_suite/gui_tests/__init__.py (original) +++ branches/uf_redesign/test_suite/gui_tests/__init__.py Tue May 22 14:03:27 2012 @@ -24,13 +24,17 @@ """The relax GUI tests.""" # Python module imports. -from relax_errors import RelaxError +from re import search from string import split from unittest import TestSuite + +# relax module imports. +from relax_errors import RelaxError # relax GUI test module imports. from bmrb import Bmrb from model_free import Mf +from n_state_model import N_state_model from noe import Noe from rx import Rx from state import State @@ -39,6 +43,7 @@ __all__ = ['bmrb', 'model_free', + 'n_state_model', 'noe', 'rx', 'state'] @@ -64,26 +69,41 @@ # Specific tests. for test in tests: - # Split. - row = split(test, '.') + # The entire test class. + if not search('\.', test): + # Check that the class exists. + if test not in globals(): + raise RelaxError("The GUI test class '%s' does not exist." % test) - # Check. - if len(row) != 2: - 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) + # The uninstantiated class object. + obj = globals()[test] - # Unpack. - class_name, test_name = row + # Add the tests. + suite_array.append(TestLoader().loadTestsFromTestCase(obj)) - # Get the class object. - obj = globals()[class_name] + # Single system test. + else: + # Split. + row = split(test, '.') - # Add the test. - suite_array.append(TestLoader().loadTestsFromNames([test_name], obj)) + # Check. + if len(row) != 2: + 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) + + # Unpack. + class_name, test_name = row + + # Get the class object. + obj = globals()[class_name] + + # Add the test. + suite_array.append(TestLoader().loadTestsFromNames([test_name], obj)) # All tests. if not tests: suite_array.append(TestLoader().loadTestsFromTestCase(Bmrb)) suite_array.append(TestLoader().loadTestsFromTestCase(Mf)) + suite_array.append(TestLoader().loadTestsFromTestCase(N_state_model)) suite_array.append(TestLoader().loadTestsFromTestCase(Noe)) suite_array.append(TestLoader().loadTestsFromTestCase(Rx)) suite_array.append(TestLoader().loadTestsFromTestCase(State))