##// END OF EJS Templates
pytest: Create test repositories from rc_testdata package.
Martin Bornhold -
r213:8a01e4c9 default
parent child Browse files
Show More
@@ -726,11 +726,9 b' def create_test_index(repo_location, con'
726
726
727 def create_test_env(repos_test_path, config):
727 def create_test_env(repos_test_path, config):
728 """
728 """
729 Makes a fresh database and
729 Makes a fresh database.
730 installs test repository into tmp dir
731 """
730 """
732 from rhodecode.lib.db_manage import DbManage
731 from rhodecode.lib.db_manage import DbManage
733 from rhodecode.tests import HG_REPO, GIT_REPO, SVN_REPO, TESTS_TMP_PATH
734
732
735 # PART ONE create db
733 # PART ONE create db
736 dbconf = config['sqlalchemy.db1.url']
734 dbconf = config['sqlalchemy.db1.url']
@@ -752,7 +750,18 b' def create_test_env(repos_test_path, con'
752 dbmanage.create_permissions()
750 dbmanage.create_permissions()
753 dbmanage.populate_default_permissions()
751 dbmanage.populate_default_permissions()
754 Session().commit()
752 Session().commit()
755 # PART TWO make test repo
753
754 create_test_repositories(repos_test_path, config)
755
756
757 def create_test_repositories(path, config):
758 """
759 Creates test repositories in the temporary directory. Repositories are
760 extracted from archives within the rc_testdata package.
761 """
762 import rc_testdata
763 from rhodecode.tests import HG_REPO, GIT_REPO, SVN_REPO, TESTS_TMP_PATH
764
756 log.debug('making test vcs repositories')
765 log.debug('making test vcs repositories')
757
766
758 idx_path = config['search.location']
767 idx_path = config['search.location']
@@ -767,21 +776,12 b' def create_test_env(repos_test_path, con'
767 log.debug('remove %s', data_path)
776 log.debug('remove %s', data_path)
768 shutil.rmtree(data_path)
777 shutil.rmtree(data_path)
769
778
770 # CREATE DEFAULT TEST REPOS
779 rc_testdata.extract_hg_dump('vcs_test_hg', jn(TESTS_TMP_PATH, HG_REPO))
771 cur_dir = dn(dn(abspath(__file__)))
780 rc_testdata.extract_git_dump('vcs_test_git', jn(TESTS_TMP_PATH, GIT_REPO))
772 with tarfile.open(jn(cur_dir, 'tests', 'fixtures',
773 'vcs_test_hg.tar.gz')) as tar:
774 tar.extractall(jn(TESTS_TMP_PATH, HG_REPO))
775
776 cur_dir = dn(dn(abspath(__file__)))
777 with tarfile.open(jn(cur_dir, 'tests', 'fixtures',
778 'vcs_test_git.tar.gz')) as tar:
779 tar.extractall(jn(TESTS_TMP_PATH, GIT_REPO))
780
781
781 # Note: Subversion is in the process of being integrated with the system,
782 # Note: Subversion is in the process of being integrated with the system,
782 # until we have a properly packed version of the test svn repository, this
783 # until we have a properly packed version of the test svn repository, this
783 # tries to copy over the repo from a package "rc_testdata"
784 # tries to copy over the repo from a package "rc_testdata"
784 import rc_testdata
785 svn_repo_path = rc_testdata.get_svn_repo_archive()
785 svn_repo_path = rc_testdata.get_svn_repo_archive()
786 with tarfile.open(svn_repo_path) as tar:
786 with tarfile.open(svn_repo_path) as tar:
787 tar.extractall(jn(TESTS_TMP_PATH, SVN_REPO))
787 tar.extractall(jn(TESTS_TMP_PATH, SVN_REPO))
General Comments 0
You need to be logged in to leave comments. Login now