Author: bugman Date: Wed Oct 8 08:39:48 2014 New Revision: 26202 URL: http://svn.gna.org/viewcvs/relax?rev=26202&view=rev Log: Merged revisions 26189-26196 via svnmerge from svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk ........ r26189 | tlinnet | 2014-10-07 15:45:35 +0200 (Tue, 07 Oct 2014) | 3 lines Added some test pymol script, to create dx maps and chi2 surface plot. These will go to the wiki: http://wiki.nmr-relax.com/Chi2_surface_plot ........ r26190 | bugman | 2014-10-07 16:11:38 +0200 (Tue, 07 Oct 2014) | 10 lines Big improvement for running the relax unit tests via the relax command line options. The unit test module path is now accepted as a command line option. This brings more capabilities of Gary Thompson's test_suite/unit_tests/unit_test_runner.py script into the relax command line. The _pipe_control/test_value unit test module path can be specified as, for example, one of 'test_suite.unit_tests._pipe_control.test_value', 'test_suite/unit_tests/_pipe_control/test_value', '_pipe_control.test_value', '_pipe_control/test_value'. This allows individual modules of tests to be run, rather than having to execute all unit tests, which is very useful for debugging. ........ r26191 | bugman | 2014-10-07 16:21:30 +0200 (Tue, 07 Oct 2014) | 8 lines Modified the printouts for the unit tests when running with the --time command line option. The test name is now being processed. The leading 'test_suite.unit_tests.' text is now stripped out. And the remaining text is split into the module name and the test name. This is to allow the unit test module name to be more easily identifiable, so it can then be used as a command line option to allow only a subset of tests to be performed. ........ r26192 | bugman | 2014-10-07 16:31:49 +0200 (Tue, 07 Oct 2014) | 6 lines Modified the help strings for the test suite options shown when 'relax -h' is run. The ability to specify individual tests (or modules of tests for the unit tests) is now documented. The '--time' option help string has also been edited. ........ r26193 | bugman | 2014-10-07 16:44:32 +0200 (Tue, 07 Oct 2014) | 7 lines Fix for the Bmrb.test_bug_22704_corrupted_state_file GUI test. This was failing because the setUp() method in the inherited Bmrb system test module was being overwritten by the default Unittest.setUp() method. Therefore the system test setUp() method has been copied into the GUI test class. ........ r26194 | bugman | 2014-10-07 17:45:07 +0200 (Tue, 07 Oct 2014) | 9 lines Fix for the Test_value.test_value_set_r1_rit test of the _pipe_control.test_value unit test module. This is a general fix for all unit test modules which use the test_suite.unit_tests.value_testing_base.Value_testing_base base class. After the molecules, residues and spins are manually created, the pipe_control.mol_res_spin.metadata_update() function is called to make sure that all of the private and volatile metadata have been correctly created, so that the other pipe_control.mol_res_spin module functions can operate correctly. ........ r26195 | bugman | 2014-10-07 17:47:01 +0200 (Tue, 07 Oct 2014) | 6 lines Removal of repetitive code in the relaxation dispersion model_loop() API method. The spin loop does not need to be called twice, instead the if statements have been modified to better direct the code execution. ........ r26196 | tlinnet | 2014-10-07 18:43:52 +0200 (Tue, 07 Oct 2014) | 26 lines Added script to simulate dispersion profiles at different settings. This shows that something is wrong. The back-calculated values in the graphs are not equal to the interpolated values. There must be something wrong somewhere. This list shows the chi2 values, and judging from the dispersion graphs, this simply cannot be True. 10.405 2.414 6722.833 9.900 1.000 6722.159 9.900 2.333 6722.159 9.900 3.667 6722.159 9.900 5.000 6722.159 10.300 1.000 6722.156 10.300 2.333 6722.156 10.300 3.667 6722.156 10.300 5.000 6722.156 10.700 1.000 6726.040 10.700 2.333 6726.040 10.700 3.667 6726.040 10.700 5.000 6726.040 11.100 1.000 6732.256 11.100 2.333 6732.256 11.100 3.667 6732.256 11.100 5.000 6732.256 ........ Added: branches/frame_order_cleanup/test_suite/shared_data/dispersion/KTeilum_FMPoulsen_MAkke_2006/surface_chi2_clustered_fitting/ - copied from r26196, trunk/test_suite/shared_data/dispersion/KTeilum_FMPoulsen_MAkke_2006/surface_chi2_clustered_fitting/ Modified: branches/frame_order_cleanup/ (props changed) branches/frame_order_cleanup/relax.py branches/frame_order_cleanup/specific_analyses/relax_disp/api.py branches/frame_order_cleanup/test_suite/gui_tests/bmrb.py branches/frame_order_cleanup/test_suite/relax_test_runner.py branches/frame_order_cleanup/test_suite/test_suite_runner.py branches/frame_order_cleanup/test_suite/unit_tests/unit_test_runner.py branches/frame_order_cleanup/test_suite/unit_tests/value_testing_base.py Propchange: branches/frame_order_cleanup/ ------------------------------------------------------------------------------ --- svnmerge-integrated (original) +++ svnmerge-integrated Wed Oct 8 08:39:48 2014 @@ -1 +1 @@ -/trunk:1-26139,26142-26176,26188 +/trunk:1-26139,26142-26176,26188-26196 Modified: branches/frame_order_cleanup/relax.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/relax.py?rev=26202&r1=26201&r2=26202&view=diff ============================================================================== --- branches/frame_order_cleanup/relax.py (original) +++ branches/frame_order_cleanup/relax.py Wed Oct 8 08:39:48 2014 @@ -312,11 +312,11 @@ # Recognised command line options for the test suite. group = OptionGroup(parser, 'Test suite options') group.add_option('-x', '--test-suite', action='store_true', dest='test_suite', default=0, help='execute the full relax test suite') - group.add_option('-s', '--system-tests', action='store_true', dest='system_tests', default=0, help='execute the system/functional tests') - group.add_option('-u', '--unit-tests', action='store_true', dest='unit_tests', default=0, help='execute the unit tests') - group.add_option('--gui-tests', action='store_true', dest='gui_tests', default=0, help='execute the GUI tests') - group.add_option('--verification-tests', action='store_true', dest='verification_tests', default=0, help='execute the software verification tests') - group.add_option('--time', action='store_true', dest='tt', default=0, help='enable the timing of individual tests in the test suite') + group.add_option('-s', '--system-tests', action='store_true', dest='system_tests', default=0, help='execute the system/functional tests. Test names, revealed with the --time option, can be supplied to perform a subset of all tests.') + group.add_option('-u', '--unit-tests', action='store_true', dest='unit_tests', default=0, help='execute the unit tests. Module names, revealed with the --time option, can be supplied to perform a subset of all tests.') + group.add_option('--gui-tests', action='store_true', dest='gui_tests', default=0, help='execute the GUI tests. Test names, revealed with the --time option, can be supplied to perform a subset of all tests.') + group.add_option('--verification-tests', action='store_true', dest='verification_tests', default=0, help='execute the software verification tests. Test names, revealed with the --time option, can be supplied to perform a subset of all tests.') + group.add_option('--time', action='store_true', dest='tt', default=0, help='print out the timings of individual tests in the test suite') group.add_option('--no-skip', action='store_true', dest='no_skip', default=0, help='a debugging option for relax developers to turn on all blacklisted tests, even those that will fail') parser.add_option_group(group) Modified: branches/frame_order_cleanup/specific_analyses/relax_disp/api.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/specific_analyses/relax_disp/api.py?rev=26202&r1=26201&r2=26202&view=diff ============================================================================== --- branches/frame_order_cleanup/specific_analyses/relax_disp/api.py (original) +++ branches/frame_order_cleanup/specific_analyses/relax_disp/api.py Wed Oct 8 08:39:48 2014 @@ -846,24 +846,7 @@ """ # Loop over individual spins for the R2eff model. - if hasattr(cdp, 'model_type'): - if cdp.model_type == MODEL_R2EFF: - # The spin loop. - for spin, spin_id in spin_loop(return_id=True): - # Skip deselected spins - if not spin.select: - continue - - # Yield the spin ID as a list. - yield [spin_id] - - # The cluster loop. - else: - for spin_ids in loop_cluster(skip_desel=False): - yield spin_ids - - # If no model is present, then set the values. - else: + if not hasattr(cdp, 'model_type') or cdp.model_type == MODEL_R2EFF: # The spin loop. for spin, spin_id in spin_loop(return_id=True): # Skip deselected spins @@ -872,6 +855,11 @@ # Yield the spin ID as a list. yield [spin_id] + + # The cluster loop. + else: + for spin_ids in loop_cluster(skip_desel=False): + yield spin_ids def model_statistics(self, model_info=None, spin_id=None, global_stats=None): Modified: branches/frame_order_cleanup/test_suite/gui_tests/bmrb.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/test_suite/gui_tests/bmrb.py?rev=26202&r1=26201&r2=26202&view=diff ============================================================================== --- branches/frame_order_cleanup/test_suite/gui_tests/bmrb.py (original) +++ branches/frame_order_cleanup/test_suite/gui_tests/bmrb.py Wed Oct 8 08:39:48 2014 @@ -22,7 +22,11 @@ # Module docstring. """GUI tests for the BMRB related activities.""" +# Python module imports. +from tempfile import mkdtemp, mktemp + # relax module imports. +from data_store import Relax_data_store; ds = Relax_data_store() from test_suite.gui_tests.base_classes import GuiTestCase from test_suite import system_tests @@ -35,3 +39,13 @@ # Force execution of the GuiTestCase __init__ method. GuiTestCase.__init__(self, methodName) + + + def setUp(self): + """Common set up for these GUI tests.""" + + # Create a temporary file name. + ds.tmpfile = mktemp() + + # Create a temporary directory for dumping files. + self.tmpdir = mkdtemp() Modified: branches/frame_order_cleanup/test_suite/relax_test_runner.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/test_suite/relax_test_runner.py?rev=26202&r1=26201&r2=26202&view=diff ============================================================================== --- branches/frame_order_cleanup/test_suite/relax_test_runner.py (original) +++ branches/frame_order_cleanup/test_suite/relax_test_runner.py Wed Oct 8 08:39:48 2014 @@ -21,6 +21,7 @@ # Python module imports. import dep_check +from re import split import sys from time import time from unittest import TextTestRunner @@ -166,10 +167,21 @@ # Subtract the end time from the start time. self.time -= time() - # Change the test name. + # Change the test name for all but unit tests. if self.category != 'unit': test_name = test_name.split('.') test_name = "%s.%s" % (test_name[-2], test_name[-1]) + + # Modify the unit test name printout. + else: + # Strip out the leading 'test_suite.unit_tests.' text. + test_name = test_name.replace('test_suite.unit_tests.', '') + + # Split out the module name from the test name. + module_name, test_name = split('.Test_', test_name) + + # Rebuild the test name. + test_name = "module %s, test Test_%s" % (module_name, test_name) # The printout. self.stream.write(' %7.2f s for %s\n' % (-self.time, test_name)) Modified: branches/frame_order_cleanup/test_suite/test_suite_runner.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/test_suite/test_suite_runner.py?rev=26202&r1=26201&r2=26202&view=diff ============================================================================== --- branches/frame_order_cleanup/test_suite/test_suite_runner.py (original) +++ branches/frame_order_cleanup/test_suite/test_suite_runner.py Wed Oct 8 08:39:48 2014 @@ -231,7 +231,7 @@ # Run the tests. unit_runner = Unit_test_runner(root_path=status.install_path+os.sep+'test_suite'+os.sep+'unit_tests') self.runner.category = 'unit' - self.unit_result = unit_runner.run(runner=self.runner) + self.unit_result = unit_runner.run(self.tests, runner=self.runner) # Print out a summary of the test suite. if summary: Modified: branches/frame_order_cleanup/test_suite/unit_tests/unit_test_runner.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/test_suite/unit_tests/unit_test_runner.py?rev=26202&r1=26201&r2=26202&view=diff ============================================================================== --- branches/frame_order_cleanup/test_suite/unit_tests/unit_test_runner.py (original) +++ branches/frame_order_cleanup/test_suite/unit_tests/unit_test_runner.py Wed Oct 8 08:39:48 2014 @@ -5,7 +5,7 @@ # (see https://gna.org/users/varioustoxins # # for contact details) # # # -# Copyright (C) 2007-2013 Edward d'Auvergne # +# Copyright (C) 2007-2014 Edward d'Auvergne # # # # # # This file is part of the program relax. # @@ -577,9 +577,11 @@ return result - def run(self, runner=None): + def run(self, tests=None, runner=None): """Run a unit test or set of unit tests. + @keyword tests: The list of system tests to perform. + @type tests: list of str @keyword runner: A unit test runner such as TextTestRunner. None indicates use of the default unit test runner. For an example of how to write a test runner see the python documentation for TextTestRunner in the python source. @type runner: Unit test runner instance (TextTestRunner, BaseGUITestRunner subclass, etc.) @return: A string indicating success or failure of the unit tests run. @@ -598,7 +600,27 @@ print('----------------') print('') - module_paths = self.paths_from_test_module(self.test_module) + # The test module path for individual tests. + if tests: + # Initialise the list of paths. + module_paths = [] + + # Loop over each test. + for test in tests: + # Strip out the leading 'test_suite.unit_tests.' if present. + test = test.replace('test_suite.unit_tests.', '') + test = test.replace('test_suite%sunit_tests%s' % (os.sep, os.sep), '') + + # Replace the Python '.' separator with the system's path separator. + test = test.replace('.', os.sep) + + # Append to the module path list. + module_paths += self.paths_from_test_module(self.test_module+os.sep+test) + + # The test module path for all tests. + else: + module_paths = self.paths_from_test_module(self.test_module) + if self.verbose: print("%-22s %s" % ('Test module:', self.test_module)) print("%-22s %s" % ('Root path', self.root_path)) Modified: branches/frame_order_cleanup/test_suite/unit_tests/value_testing_base.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/test_suite/unit_tests/value_testing_base.py?rev=26202&r1=26201&r2=26202&view=diff ============================================================================== --- branches/frame_order_cleanup/test_suite/unit_tests/value_testing_base.py (original) +++ branches/frame_order_cleanup/test_suite/unit_tests/value_testing_base.py Wed Oct 8 08:39:48 2014 @@ -25,7 +25,7 @@ # relax module imports. from data_store import Relax_data_store; ds = Relax_data_store() -from pipe_control import diffusion_tensor, pipes +from pipe_control import diffusion_tensor, pipes, mol_res_spin from lib.errors import RelaxError, RelaxParamSetError, RelaxUnknownParamCombError from test_suite.unit_tests.base_classes import UnitTestCase @@ -98,6 +98,9 @@ pipe.mol[0].res[1].spin[0].num = 112 pipe.mol[0].res[1].spin[0].name = 'NH' + # Update the metadata so that the other pipe_control.mol_res_spin module functions can operate correctly. + mol_res_spin.metadata_update(pipe=pipe_name) +