# HG changeset patch # User Patrick Mezard # Date 1334852972 -7200 # Node ID a279b5838aaf4ddcdb18aa09dbe573e68c339a02 # Parent 51fd75ae62b98ccf6291cd3eb9befee6681595d9 test_util: remove self.repo_path, generate new paths each time This solves a problem with startrev tests sporadically failing in ra.get_log() with some kind of svn corruption error. Loading each svn repository in a different place solved that, or at least prevented me from reproducing it. What is interesting is this is the same fixture being loaded each time. Also, before loading the fixture, we take care of removing an existing repository. Loading with the same options twice also failed reproducing the issue. Same thing if the first load only load the svn repository but does not convert it. So, I have absolutely no idea what was wrong, blame python subprocess, subversion or some kind of filesystem write ordering bug. diff --git a/tests/test_push_command.py b/tests/test_push_command.py --- a/tests/test_push_command.py +++ b/tests/test_push_command.py @@ -23,7 +23,7 @@ import time class PushTests(test_util.TestBase): def setUp(self): test_util.TestBase.setUp(self) - self._load_fixture_and_fetch('simple_branch.svndump') + self.repo_path = self.load_and_fetch('simple_branch.svndump')[1] def test_cant_push_empty_ctx(self): repo = self.repo diff --git a/tests/test_push_renames.py b/tests/test_push_renames.py --- a/tests/test_push_renames.py +++ b/tests/test_push_renames.py @@ -6,8 +6,8 @@ import unittest class TestPushRenames(test_util.TestBase): def setUp(self): test_util.TestBase.setUp(self) - self._load_fixture_and_fetch('pushrenames.svndump', - stupid=True) + self.repo_path = self.load_and_fetch('pushrenames.svndump', + stupid=True)[1] def _debug_print_copies(self, ctx): w = sys.stderr.write diff --git a/tests/test_util.py b/tests/test_util.py --- a/tests/test_util.py +++ b/tests/test_util.py @@ -252,7 +252,7 @@ class TestBase(unittest.TestCase): for l in '[extensions]', 'hgsubversion=': print >> rc, l - self.repo_path = '%s/testrepo' % self.tmpdir + self.repocount = 0 self.wc_path = '%s/testrepo_wc' % self.tmpdir self.svn_wc = None @@ -264,6 +264,10 @@ class TestBase(unittest.TestCase): self.patch = (ui.ui.write_err, ui.ui.write) setattr(ui.ui, self.patch[0].func_name, self.patch[1]) + def _makerepopath(self): + self.repocount += 1 + return '%s/testrepo-%d' % (self.tmpdir, self.repocount) + def tearDown(self): for var, val in self.oldenv.iteritems(): if val is None: @@ -284,9 +288,8 @@ class TestBase(unittest.TestCase): '''Loads an svnadmin dump into a fresh repo. Return the svn repo path. ''' - path = self.repo_path - if os.path.exists(path): - rmtree(path) + path = self._makerepopath() + assert not os.path.exists(path) subprocess.call(['svnadmin', 'create', path,], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) inp = open(os.path.join(FIXTURES, fixture_name))