Author: bugman Date: Wed Aug 12 13:54:53 2009 New Revision: 9281 URL: http://svn.gna.org/viewcvs/relax?rev=9281&view=rev Log: Modified the unit tests to be more non-Unix operating system compatible. Modified: 1.3/test_suite/unit_tests/_generic_fns/_structure/test_internal.py 1.3/test_suite/unit_tests/_generic_fns/_structure/test_scientific.py 1.3/test_suite/unit_tests/_specific_fns/_model_free/test_main.py 1.3/test_suite/unit_tests/relax_data_testing_base.py 1.3/test_suite/unit_tests/sequence_testing_base.py 1.3/test_suite/unit_tests/state_testing_base.py 1.3/test_suite/unit_tests/test_relax_io.py Modified: 1.3/test_suite/unit_tests/_generic_fns/_structure/test_internal.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/unit_tests/_generic_fns/_structure/test_internal.py?rev=9281&r1=9280&r2=9281&view=diff ============================================================================== --- 1.3/test_suite/unit_tests/_generic_fns/_structure/test_internal.py (original) +++ 1.3/test_suite/unit_tests/_generic_fns/_structure/test_internal.py Wed Aug 12 13:54:53 2009 @@ -21,7 +21,7 @@ ############################################################################### # Python module imports. -from os import path +from os import path, sep import sys from unittest import TestCase @@ -43,7 +43,7 @@ self.path = sys.path[-1] # The path to a PDB file. - self.test_pdb_path = self.path+'/test_suite/shared_data/structures/Ap4Aase_res1-12.pdb' + self.test_pdb_path = self.path+sep+'test_suite'+sep+'shared_data'+sep+'structures'+sep+'Ap4Aase_res1-12.pdb' expanded = path.split(self.test_pdb_path) self.test_pdb_dir = expanded[0] self.test_pdb_file_name = expanded[1] Modified: 1.3/test_suite/unit_tests/_generic_fns/_structure/test_scientific.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/unit_tests/_generic_fns/_structure/test_scientific.py?rev=9281&r1=9280&r2=9281&view=diff ============================================================================== --- 1.3/test_suite/unit_tests/_generic_fns/_structure/test_scientific.py (original) +++ 1.3/test_suite/unit_tests/_generic_fns/_structure/test_scientific.py Wed Aug 12 13:54:53 2009 @@ -21,7 +21,7 @@ ############################################################################### # Python module imports. -from os import path +from os import path, sep import sys from unittest import TestCase @@ -44,7 +44,7 @@ self.path = sys.path[-1] # The path to a PDB file. - self.test_pdb_path = self.path+'/test_suite/shared_data/structures/Ap4Aase_res1-12.pdb' + self.test_pdb_path = self.path+sep+'test_suite'+sep+'shared_data'+sep+'structures'+sep+'Ap4Aase_res1-12.pdb' expanded = path.split(self.test_pdb_path) self.test_pdb_dir = expanded[0] self.test_pdb_file_name = expanded[1] Modified: 1.3/test_suite/unit_tests/_specific_fns/_model_free/test_main.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/unit_tests/_specific_fns/_model_free/test_main.py?rev=9281&r1=9280&r2=9281&view=diff ============================================================================== --- 1.3/test_suite/unit_tests/_specific_fns/_model_free/test_main.py (original) +++ 1.3/test_suite/unit_tests/_specific_fns/_model_free/test_main.py Wed Aug 12 13:54:53 2009 @@ -21,6 +21,7 @@ ############################################################################### # Python module imports. +from os import sep import sys from unittest import TestCase @@ -62,7 +63,7 @@ """Test the model-free duplicate_data() method.""" # Read a model-free results file. - results.read(file='final_results_trunc_1.3', directory=sys.path[-1] + '/test_suite/shared_data/model_free/OMP') + results.read(file='final_results_trunc_1.3', directory=sys.path[-1] + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'OMP') # Duplicate the data. self.inst.duplicate_data('orig', 'new', model_index=0) @@ -72,10 +73,10 @@ """Test the model-free duplicate_data() method.""" # Read a model-free results file. - results.read(file='final_results_trunc_1.3', directory=sys.path[-1] + '/test_suite/shared_data/model_free/OMP') + results.read(file='final_results_trunc_1.3', directory=sys.path[-1] + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'OMP') # Load a structure. - structure.main.read_pdb(file='Ap4Aase_res1-12.pdb', dir=sys.path[-1] + '/test_suite/shared_data/structures', read_model=1, parser='internal') + structure.main.read_pdb(file='Ap4Aase_res1-12.pdb', dir=sys.path[-1] + sep+'test_suite'+sep+'shared_data'+sep+'structures', read_model=1, parser='internal') # Duplicate the data. self.inst.duplicate_data('orig', 'new', model_index=0) @@ -91,10 +92,10 @@ """Test the model-free duplicate_data() method.""" # Read a model-free results file. - results.read(file='final_results_trunc_1.3', directory=sys.path[-1] + '/test_suite/shared_data/model_free/OMP') + results.read(file='final_results_trunc_1.3', directory=sys.path[-1] + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'OMP') # Load a structure. - structure.main.read_pdb(file='Ap4Aase_res1-12.pdb', dir=sys.path[-1] + '/test_suite/shared_data/structures', read_model=1, parser='internal') + structure.main.read_pdb(file='Ap4Aase_res1-12.pdb', dir=sys.path[-1] + sep+'test_suite'+sep+'shared_data'+sep+'structures', read_model=1, parser='internal') # Duplicate the data, model by model. self.inst.duplicate_data('orig', 'new', model_index=0) @@ -107,16 +108,16 @@ """Test the failure of the model-free duplicate_data() method when the structures are not consistent.""" # Read a model-free results file. - results.read(file='final_results_trunc_1.3', directory=sys.path[-1] + '/test_suite/shared_data/model_free/OMP') + results.read(file='final_results_trunc_1.3', directory=sys.path[-1] + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'OMP') # Load a structure. - structure.main.read_pdb(file='Ap4Aase_res1-12.pdb', dir=sys.path[-1] + '/test_suite/shared_data/structures', read_model=1, parser='internal') + structure.main.read_pdb(file='Ap4Aase_res1-12.pdb', dir=sys.path[-1] + sep+'test_suite'+sep+'shared_data'+sep+'structures', read_model=1, parser='internal') # Create a new model-free data pipe. ds.add(pipe_name='new', pipe_type='mf') # Load the structure for the second pipe. - structure.main.read_pdb(file='Ap4Aase_res1-12.pdb', dir=sys.path[-1] + '/test_suite/shared_data/structures', read_model=1, parser='internal') + structure.main.read_pdb(file='Ap4Aase_res1-12.pdb', dir=sys.path[-1] + sep+'test_suite'+sep+'shared_data'+sep+'structures', read_model=1, parser='internal') # Modify the structure. dp = pipes.get_pipe('new') Modified: 1.3/test_suite/unit_tests/relax_data_testing_base.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/unit_tests/relax_data_testing_base.py?rev=9281&r1=9280&r2=9281&view=diff ============================================================================== --- 1.3/test_suite/unit_tests/relax_data_testing_base.py (original) +++ 1.3/test_suite/unit_tests/relax_data_testing_base.py Wed Aug 12 13:54:53 2009 @@ -20,10 +20,13 @@ # # ############################################################################### +# Python module imports. +from os import sep +import sys + # relax module imports. from data import Relax_data_store; ds = Relax_data_store() from generic_fns import pipes, sequence -import sys class Relax_data_base_class: @@ -72,10 +75,10 @@ path = sys.path[-1] # First read the residue sequence out of the Ap4Aase 600 MHz NOE data file. - sequence.read(file='Ap4Aase.Noe.600.bz2', dir=path+'/test_suite/shared_data/relaxation_data') + sequence.read(file='Ap4Aase.Noe.600.bz2', dir=path+sep+'test_suite'+sep+'shared_data'+sep+'relaxation_data') # Then read the data out of the same file. - self.relax_data_fns.read(ri_label='NOE', frq_label='600', frq=600e6, file='Ap4Aase.Noe.600.bz2', dir=path+'/test_suite/shared_data/relaxation_data') + self.relax_data_fns.read(ri_label='NOE', frq_label='600', frq=600e6, file='Ap4Aase.Noe.600.bz2', dir=path+sep+'test_suite'+sep+'shared_data'+sep+'relaxation_data') # Alias the current data pipe. cdp = pipes.get_pipe() Modified: 1.3/test_suite/unit_tests/sequence_testing_base.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/unit_tests/sequence_testing_base.py?rev=9281&r1=9280&r2=9281&view=diff ============================================================================== --- 1.3/test_suite/unit_tests/sequence_testing_base.py (original) +++ 1.3/test_suite/unit_tests/sequence_testing_base.py Wed Aug 12 13:54:53 2009 @@ -21,7 +21,7 @@ ############################################################################### # Python module imports. -from os import remove +from os import remove, sep import sys from tempfile import mktemp try: @@ -147,7 +147,7 @@ path = sys.path[-1] # Read the residue sequence out of the Ap4Aase 600 MHz NOE data file. - self.sequence_fns.read(file='Ap4Aase.Noe.600.bz2', dir=path+'/test_suite/shared_data/relaxation_data') + self.sequence_fns.read(file='Ap4Aase.Noe.600.bz2', dir=path+sep+'test_suite'+sep+'shared_data'+sep+'relaxation_data') # Get the data pipe. dp = pipes.get_pipe('orig') Modified: 1.3/test_suite/unit_tests/state_testing_base.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/unit_tests/state_testing_base.py?rev=9281&r1=9280&r2=9281&view=diff ============================================================================== --- 1.3/test_suite/unit_tests/state_testing_base.py (original) +++ 1.3/test_suite/unit_tests/state_testing_base.py Wed Aug 12 13:54:53 2009 @@ -21,7 +21,7 @@ ############################################################################### # Python module imports. -from os import tmpfile +from os import sep, tmpfile import sys # relax module imports. @@ -73,7 +73,7 @@ path = sys.path[-1] # Load the state. - self.state.load_state(state='basic_single_pipe', dir_name=path+'/test_suite/shared_data/saved_states') + self.state.load_state(state='basic_single_pipe', dir_name=path+sep+'test_suite'+sep+'shared_data'+sep+'saved_states') # Get the data pipe. dp = pipes.get_pipe('orig') @@ -102,7 +102,7 @@ path = sys.path[-1] # Load the state. - self.state.load_state(state='basic_single_pipe', dir_name=path+'/test_suite/shared_data/saved_states') + self.state.load_state(state='basic_single_pipe', dir_name=path+sep+'test_suite'+sep+'shared_data'+sep+'saved_states') # Add a new data pipe and some data to it. ds.add('new', 'jw_mapping') @@ -138,7 +138,7 @@ path = sys.path[-1] # Load the state. - self.state.load_state(state='basic_single_pipe', dir_name=path+'/test_suite/shared_data/saved_states') + self.state.load_state(state='basic_single_pipe', dir_name=path+sep+'test_suite'+sep+'shared_data'+sep+'saved_states') # Reset. ds.__reset__() Modified: 1.3/test_suite/unit_tests/test_relax_io.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/unit_tests/test_relax_io.py?rev=9281&r1=9280&r2=9281&view=diff ============================================================================== --- 1.3/test_suite/unit_tests/test_relax_io.py (original) +++ 1.3/test_suite/unit_tests/test_relax_io.py Wed Aug 12 13:54:53 2009 @@ -21,6 +21,7 @@ ############################################################################### # Python module imports. +from os import sep from unittest import TestCase # relax module imports. @@ -36,8 +37,8 @@ # Some file paths that shouldn't change. file1 = 'test' - file2 = 'test/aaa' - file3 = '/home/test/aaa' + file2 = 'test'+sep+'aaa' + file3 = sep+'home'+sep+'test'+sep+'aaa' # Check that nothing changes. self.assertEqual(relax_io.get_file_path(file1), file1) @@ -50,26 +51,26 @@ # Some file paths. file1 = 'test' - file2 = 'test/aaa' - file3 = '/home/test/aaa' + file2 = 'test'+sep+'aaa' + file3 = sep+'home'+sep+'test'+sep+'aaa' # Some directories. - dir1 = '/usr' + dir1 = sep+'usr' dir2 = 'usr' - dir3 = '/usr' + dir3 = sep+'usr' # Check that nothing changes. - self.assertEqual(relax_io.get_file_path(file1, dir1), dir1+'/'+file1) - self.assertEqual(relax_io.get_file_path(file2, dir2), dir2+'/'+file2) - self.assertEqual(relax_io.get_file_path(file3, dir=dir3), dir3+'/'+file3) + self.assertEqual(relax_io.get_file_path(file1, dir1), dir1+sep+file1) + self.assertEqual(relax_io.get_file_path(file2, dir2), dir2+sep+file2) + self.assertEqual(relax_io.get_file_path(file3, dir=dir3), dir3+sep+file3) def test_get_file_path_with_homedir(self): """The modification of file paths with '~', by relax_io.get_file_path.""" # Some file paths. - file1 = '~/test' - file2 = '~/test/aaa' + file1 = '~'+sep+'test' + file2 = '~'+sep+'test'+sep+'aaa' # Check that nothing changes. self.assertNotEqual(relax_io.get_file_path(file1), file1)