Mercurial > hgsubversion
diff tests/test_util.py @ 872:a279b5838aaf
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.
author | Patrick Mezard <patrick@mezard.eu> |
---|---|
date | Thu, 19 Apr 2012 18:29:32 +0200 |
parents | 51fd75ae62b9 |
children | f2de043ac924 |
line wrap: on
line diff
--- 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))