Package test_suite :: Package system_tests :: Module base_classes
[hide private]
[frames] | no frames]

Source Code for Module test_suite.system_tests.base_classes

 1  ############################################################################### 
 2  #                                                                             # 
 3  # Copyright (C) 2010-2011 Edward d'Auvergne                                   # 
 4  #                                                                             # 
 5  # This file is part of the program relax.                                     # 
 6  #                                                                             # 
 7  # relax 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 2 of the License, or           # 
10  # (at your option) any later version.                                         # 
11  #                                                                             # 
12  # relax 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 relax; if not, write to the Free Software                        # 
19  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   # 
20  #                                                                             # 
21  ############################################################################### 
22   
23  # Module docstring. 
24  """Base classes for the system tests.""" 
25   
26  # Python module imports. 
27  from shutil import rmtree 
28  from unittest import TestCase 
29   
30  # relax module imports. 
31  from data import Relax_data_store; ds = Relax_data_store() 
32  from generic_fns.reset import reset 
33  from prompt.interpreter import Interpreter 
34  from relax_io import delete 
35   
36   
37 -class SystemTestCase(TestCase):
38 - def __init__(self, methodName=None):
39 """Set up the test case class for the system tests.""" 40 41 # Execute the TestCase __init__ method. 42 super(SystemTestCase, self).__init__(methodName) 43 44 # Load the interpreter. 45 self.interpreter = Interpreter(show_script=False, quit=False, raise_relax_error=True) 46 self.interpreter.populate_self() 47 self.interpreter.on(verbose=False)
48 49
50 - def tearDown(self):
51 """Default tearDown operation - delete temp directories and files and reset relax.""" 52 53 # Remove the temporary directories. 54 if hasattr(ds, 'tmpdir'): 55 # Delete the directory. 56 rmtree(ds.tmpdir) 57 58 # Remove the variable. 59 del ds.tmpdir 60 61 # Remove the temporary directories. 62 if hasattr(self, 'tmpdir'): 63 # Delete the directory. 64 rmtree(self.tmpdir) 65 66 # Remove the variable. 67 del self.tmpdir 68 69 # Remove temporary files. 70 if hasattr(ds, 'tmpfile'): 71 # Delete the file. 72 delete(ds.tmpfile, fail=False) 73 74 # Remove the variable. 75 del ds.tmpfile 76 77 # Remove temporary files. 78 if hasattr(self, 'tmpfile'): 79 # Delete the file. 80 delete(self.tmpfile, fail=False) 81 82 # Remove the variable. 83 del self.tmpfile 84 85 # Reset relax. 86 reset()
87