Trees | Indices | Help |
|
---|
|
1 ############################################################################### 2 # # 3 # Copyright (C) 2010-2012 Edward d'Auvergne # 4 # # 5 # This file is part of the program relax (http://www.nmr-relax.com). # 6 # # 7 # This program is free software: you can redistribute it and/or modify # 8 # it under the terms of the GNU General Public License as published by # 9 # the Free Software Foundation, either version 3 of the License, or # 10 # (at your option) any later version. # 11 # # 12 # This program is distributed in the hope that it will be useful, # 13 # but WITHOUT ANY WARRANTY; without even the implied warranty of # 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 15 # GNU General Public License for more details. # 16 # # 17 # You should have received a copy of the GNU General Public License # 18 # along with this program. If not, see <http://www.gnu.org/licenses/>. # 19 # # 20 ############################################################################### 21 22 # Module docstring. 23 """Base classes for the system tests.""" 24 25 # Python module imports. 26 from os import sep 27 from shutil import rmtree 28 from time import sleep 29 from unittest import TestCase 30 31 # relax module imports. 32 from data import Relax_data_store; ds = Relax_data_store() 33 from generic_fns.reset import reset 34 from prompt.interpreter import Interpreter 35 from relax_io import delete 36 3739 """The system test base class.""" 4011142 """Set up the test case class for the system tests.""" 43 44 # Execute the TestCase __init__ method. 45 super(SystemTestCase, self).__init__(methodName) 46 47 # A string used for classifying skipped tests. 48 if not hasattr(self, '_skip_type'): 49 self._skip_type = 'system' 50 51 # Load the interpreter. 52 self.interpreter = Interpreter(show_script=False, quit=False, raise_relax_error=True) 53 self.interpreter.populate_self() 54 self.interpreter.on(verbose=False)55 5658 """Execute a relax script within the system test framework. 59 60 @param script: The full path of the script to execute. 61 @type script: str 62 """ 63 64 # Execute the script. 65 self.interpreter.run(script_file=script)66 6769 """Default tearDown operation - delete temp directories and files and reset relax.""" 70 71 # Remove the temporary directories. 72 if hasattr(ds, 'tmpdir'): 73 # Delete the directory. 74 rmtree(ds.tmpdir) 75 76 # Remove the variable. 77 del ds.tmpdir 78 79 # Remove the temporary directories. 80 if hasattr(self, 'tmpdir'): 81 # Delete the directory. 82 rmtree(self.tmpdir) 83 84 # Remove the variable. 85 del self.tmpdir 86 87 # Remove temporary files. 88 if hasattr(ds, 'tmpfile'): 89 # MS Windows kludge - avoid the WindowsError due to the file still being open by the state.save or results.write user functions. 90 sleep(0.01) 91 92 # Delete the file. 93 delete(ds.tmpfile, fail=False) 94 95 # Remove the variable. 96 del ds.tmpfile 97 98 # Remove temporary files. 99 if hasattr(self, 'tmpfile'): 100 # MS Windows kludge - avoid the WindowsError due to the file still being open by the state.save or results.write user functions. 101 sleep(0.01) 102 103 # Delete the file. 104 delete(self.tmpfile, fail=False) 105 106 # Remove the variable. 107 del self.tmpfile 108 109 # Reset relax. 110 reset()
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Apr 10 15:06:37 2013 | http://epydoc.sourceforge.net |