Author: bugman Date: Thu Nov 22 10:23:43 2007 New Revision: 3793 URL: http://svn.gna.org/viewcvs/relax?rev=3793&view=rev Log: Modified the state.load() and state.save() unit tests to use a tmp file descriptor. Currently these functions only allow a string file name and don't handle file descriptors, but this will be changed. Modified: 1.3/test_suite/unit_tests/state_testing_base.py 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=3793&r1=3792&r2=3793&view=diff ============================================================================== --- 1.3/test_suite/unit_tests/state_testing_base.py (original) +++ 1.3/test_suite/unit_tests/state_testing_base.py Thu Nov 22 10:23:43 2007 @@ -21,7 +21,7 @@ ############################################################################### # Python module imports. -from os import remove +from os import remove, tmpfile # relax module imports. from data import Data as relax_data_store @@ -38,6 +38,9 @@ def setUp(self): """Set up for all the data pipe unit tests.""" + # Create a temporary file descriptor. + self.tmp_file = tmpfile() + # Reset the relax data storage object. relax_data_store.__reset__() @@ -53,6 +56,9 @@ def tearDown(self): """Reset the relax data storage object.""" + + # Delete the temporary file descriptor. + del self.tmp_file # Reset the relax data store. relax_data_store.__reset__() @@ -71,7 +77,7 @@ """ # Save the state. - self.state.save_state(file='test') + self.state.save_state(file=self.tmp_file) # Reset the relax data store. relax_data_store.__reset__() @@ -82,7 +88,7 @@ self.assert_(not hasattr(relax_data_store, 'y')) # Load the state. - self.state.load_state(file='test') + self.state.load_state(file=self.tmp_file) # Test the contents of the restored singleton. self.assertEqual(relax_data_store.keys(), ['orig']) @@ -96,5 +102,8 @@ This tests the normal operation of the generic_fns.state.save() function. """ + # Create a temporary file descriptor. + self.tmp_file = tmpfile() + # Save the state. - self.state.save_state(file='test') + self.state.save_state(file=self.tmp_file)