Commit 939e226f authored by Michal Čihař's avatar Michal Čihař

Prepare infrastructure for Mercurial repository testing

Issue #511
Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 7a181233
......@@ -33,11 +33,12 @@ from weblate.trans.models import Project, SubProject, Unit, WhiteboardMessage
from weblate.trans.models.source import Source
from weblate import appsettings
from weblate.trans.tests.utils import get_test_file
from weblate.trans.vcs import GitRepository
from weblate.trans.vcs import GitRepository, HgRepository
REPOWEB_URL = \
'https://github.com/nijel/weblate-test/blob/master/%(file)s#L%(line)s'
GIT_URL = 'git://github.com/nijel/weblate-test.git'
HG_URL = 'https://nijel@bitbucket.org/nijel/weblate-test'
class RepoTestCase(TestCase):
......@@ -61,6 +62,17 @@ class RepoTestCase(TestCase):
'test-repo.git'
)
# Path where to clone remote repo for tests
self.hg_base_repo_path = os.path.join(
settings.GIT_ROOT,
'test-base-repo.hg'
)
# Repository on which tests will be performed
self.hg_repo_path = os.path.join(
settings.GIT_ROOT,
'test-repo.hg'
)
# Clone repo for testing
if not os.path.exists(self.git_base_repo_path):
GitRepository.clone(
......@@ -76,6 +88,21 @@ class RepoTestCase(TestCase):
# Create repository copy for the test
shutil.copytree(self.git_base_repo_path, self.git_repo_path)
# Clone repo for testing
if not os.path.exists(self.hg_base_repo_path):
HgRepository.clone(
HG_URL,
self.hg_base_repo_path,
bare=True
)
# Remove possibly existing directory
if os.path.exists(self.hg_repo_path):
shutil.rmtree(self.hg_repo_path)
# Create repository copy for the test
shutil.copytree(self.hg_base_repo_path, self.hg_repo_path)
# Remove possibly existing project directory
test_repo_path = os.path.join(settings.GIT_ROOT, 'test')
if os.path.exists(test_repo_path):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment