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