~earl.chew/zim/pyzim-refactor-umlet

« back to all changes in this revision

Viewing changes to tests/__init__.py

  • Committer: Jaap Karssenberg
  • Date: 2013-09-29 01:24:15 UTC
  • Revision ID: jaap.karssenberg@gmail.com-20130929012415-o3bkym77xwnz8c16
refactored config file lookup - profiles not yet supported, but prepared

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
# This list also determines the order in which tests will executed
39
39
__all__ = [
40
40
        'package', 'translations',
41
 
        'utils', 'errors', 'signals',
 
41
        'utils', 'errors', 'signals', 'environ',
42
42
        'fs', 'config', 'applications', 'async',
43
43
        'parsing', 'formats', 'templates',
44
44
        'stores', 'index', 'notebook', 'history',
182
182
                The dir is removed and recreated empty every time this function
183
183
                is called with the same name from the same class.
184
184
                '''
 
185
                self.clear_tmp_dir(name)
185
186
                path = self._get_tmp_name(name)
186
 
                if os.path.exists(path):
187
 
                        shutil.rmtree(path)
188
 
                assert not os.path.exists(path) # make real sure
189
187
                os.makedirs(path)
190
188
                assert os.path.exists(path) # make real sure
191
189
                return path
199
197
                assert not os.path.exists(path), 'This path should not exist: %s' % path
200
198
                return path
201
199
 
 
200
        def clear_tmp_dir(self, name=None):
 
201
                '''Clears the tmp dir for this test'''
 
202
                path = self._get_tmp_name(name)
 
203
                if os.path.exists(path):
 
204
                        shutil.rmtree(path)
 
205
                assert not os.path.exists(path) # make real sure
 
206
 
202
207
        def _get_tmp_name(self, name):
203
208
                if name:
204
209
                        assert not os.path.sep in name, 'Don\'t use this method to get sub folders or files'