changeset 1397:dc960653f8d2 beta

Added new random directory for each test to be better sandboxed
author Marcin Kuzminski <marcin@python-works.com>
date Wed, 29 Jun 2011 00:41:51 +0200
parents 069ee86e85ad
children 6dee43453f58
files rhodecode/lib/utils.py rhodecode/tests/__init__.py
diffstat 2 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/lib/utils.py	Wed Jun 29 00:25:33 2011 +0200
+++ b/rhodecode/lib/utils.py	Wed Jun 29 00:41:51 2011 +0200
@@ -514,6 +514,11 @@
     dbconf = config['sqlalchemy.db1.url']
     log.debug('making test db %s', dbconf)
 
+    # create test dir if it doesn't exist
+    if not os.path.isdir(repos_test_path):
+        log.debug('Creating testdir %s' % repos_test_path)
+        os.makedirs(repos_test_path)
+
     dbmanage = DbManage(log_sql=True, dbconf=dbconf, root=config['here'],
                         tests=True)
     dbmanage.create_tables(override=True)
--- a/rhodecode/tests/__init__.py	Wed Jun 29 00:25:33 2011 +0200
+++ b/rhodecode/tests/__init__.py	Wed Jun 29 00:41:51 2011 +0200
@@ -38,8 +38,8 @@
 environ = {}
 
 #SOME GLOBALS FOR TESTS
-TESTS_TMP_PATH = jn('/', 'tmp')
-
+from tempfile import _RandomNameSequence
+TESTS_TMP_PATH = jn('/', 'tmp', 'rc_test_%s' % _RandomNameSequence().next())
 HG_REPO = 'vcs_test_hg'
 GIT_REPO = 'vcs_test_git'