changeset 1396:069ee86e85ad beta

cleanup before start testing suite of index and data cache dirs
author Marcin Kuzminski <marcin@python-works.com>
date Wed, 29 Jun 2011 00:25:33 +0200
parents eee3cb592099
children dc960653f8d2
files rhodecode/lib/utils.py
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/lib/utils.py	Fri Jun 24 16:00:12 2011 +0200
+++ b/rhodecode/lib/utils.py	Wed Jun 29 00:25:33 2011 +0200
@@ -533,6 +533,18 @@
             log.debug('removing %s', r)
             shutil.rmtree(jn(TESTS_TMP_PATH, r))
 
+    idx_path = config['app_conf']['index_dir']
+    data_path = config['app_conf']['cache_dir']
+
+    #clean index and data
+    if idx_path and os.path.exists(idx_path):
+        log.debug('remove %s' % idx_path)
+        shutil.rmtree(idx_path)
+
+    if data_path and os.path.exists(data_path):
+        log.debug('remove %s' % data_path)
+        shutil.rmtree(data_path)
+
     #CREATE DEFAULT HG REPOSITORY
     cur_dir = dn(dn(abspath(__file__)))
     tar = tarfile.open(jn(cur_dir, 'tests', "vcs_test_hg.tar.gz"))