Author: bugman Date: Tue Jul 10 17:39:28 2012 New Revision: 17224 URL: http://svn.gna.org/viewcvs/relax?rev=17224&view=rev Log: Bug fix for MS Windows for the deletion of temporary files in the system tests. For certain Windows/Python combinations, a WindowsError was being raised saying that the file cannot be deleted as it is being used by another process. This happens when the XML file from a results.write or state.save user function call is deleted by the system test tearDown() method. Modified: trunk/test_suite/system_tests/base_classes.py Modified: trunk/test_suite/system_tests/base_classes.py URL: http://svn.gna.org/viewcvs/relax/trunk/test_suite/system_tests/base_classes.py?rev=17224&r1=17223&r2=17224&view=diff ============================================================================== --- trunk/test_suite/system_tests/base_classes.py (original) +++ trunk/test_suite/system_tests/base_classes.py Tue Jul 10 17:39:28 2012 @@ -1,6 +1,6 @@ ############################################################################### # # -# Copyright (C) 2010-2011 Edward d'Auvergne # +# Copyright (C) 2010-2012 Edward d'Auvergne # # # # This file is part of the program relax. # # # @@ -26,6 +26,7 @@ # Python module imports. from os import sep from shutil import rmtree +from time import sleep from unittest import TestCase # relax module imports. @@ -86,6 +87,9 @@ # Remove temporary files. if hasattr(ds, 'tmpfile'): + # MS Windows kludge - avoid the WindowsError due to the file still being open by the state.save or results.write user functions. + sleep(0.01) + # Delete the file. delete(ds.tmpfile, fail=False) @@ -94,6 +98,9 @@ # Remove temporary files. if hasattr(self, 'tmpfile'): + # MS Windows kludge - avoid the WindowsError due to the file still being open by the state.save or results.write user functions. + sleep(0.01) + # Delete the file. delete(self.tmpfile, fail=False)