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

Source Code for Module test_suite.unit_tests.base_classes

 1  ############################################################################### 
 2  #                                                                             # 
 3  # Copyright (C) 2010-2011 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 shutil import rmtree 
27  from unittest import TestCase 
28   
29  # relax module imports. 
30  from data import Relax_data_store; ds = Relax_data_store() 
31  from generic_fns.reset import reset 
32  from relax_io import delete 
33   
34   
35 -class UnitTestCase(TestCase):
36 """relax test case class specific for the unit tests.""" 37
38 - def tearDown(self):
39 """Default tearDown operation - delete temp directories and files and reset relax.""" 40 41 # Remove the temporary directories. 42 if hasattr(ds, 'tmpdir'): 43 # Delete the directory. 44 rmtree(ds.tmpdir) 45 46 # Remove the variable. 47 del ds.tmpdir 48 49 # Remove the temporary directories. 50 if hasattr(self, 'tmpdir'): 51 # Delete the directory. 52 rmtree(self.tmpdir) 53 54 # Remove the variable. 55 del self.tmpdir 56 57 # Remove temporary files. 58 if hasattr(ds, 'tmpfile'): 59 # Delete the file. 60 delete(ds.tmpfile, fail=False) 61 62 # Remove the variable. 63 del ds.tmpfile 64 65 # Remove temporary files. 66 if hasattr(self, 'tmpfile'): 67 # Delete the file. 68 delete(self.tmpfile, fail=False) 69 70 # Remove the variable. 71 del self.tmpfile 72 73 # Reset relax. 74 reset()
75