# HG changeset patch # User Patrick Mezard # Date 1334852971 -7200 # Node ID 51fd75ae62b98ccf6291cd3eb9befee6681595d9 # Parent 1eb2a4428c4294f74d1476187bb86051cead9270 test_util: pass repo_path to svnpropget(), turn into a function diff --git a/tests/test_single_dir_clone.py b/tests/test_single_dir_clone.py --- a/tests/test_single_dir_clone.py +++ b/tests/test_single_dir_clone.py @@ -111,12 +111,14 @@ class TestSingleDir(test_util.TestBase): self.pushrevisions() self.assertTrue('adding_file' in test_util.svnls(repo_path, '')) self.assertEqual('application/octet-stream', - self.svnpropget('adding_binary', 'svn:mime-type')) + test_util.svnpropget(repo_path, 'adding_binary', + 'svn:mime-type')) # Now add another commit and test mime-type being reset changes = [('adding_binary', 'adding_binary', 'no longer binary')] self.commitchanges(changes) self.pushrevisions() - self.assertEqual('', self.svnpropget('adding_binary', 'svn:mime-type')) + self.assertEqual('', test_util.svnpropget(repo_path, 'adding_binary', + 'svn:mime-type')) def test_push_single_dir_at_subdir(self): repo = self._load_fixture_and_fetch('branch_from_tag.svndump', diff --git a/tests/test_util.py b/tests/test_util.py --- a/tests/test_util.py +++ b/tests/test_util.py @@ -221,6 +221,18 @@ def svnls(repo_path, path, rev='HEAD'): entries.sort() return entries +def svnpropget(repo_path, path, prop, rev='HEAD'): + path = repo_path + '/' + path + path = util.normalize_url(fileurl(path)) + args = ['svn', 'propget', '-r', str(rev), prop, path] + p = subprocess.Popen(args, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) + stdout, stderr = p.communicate() + if p.returncode: + raise Exception('svn ls failed on %s: %r' % (path, stderr)) + return stdout.strip() + class TestBase(unittest.TestCase): def setUp(self): _verify_our_modules() @@ -367,18 +379,6 @@ class TestBase(unittest.TestCase): if p.returncode: raise Exception('svn co failed on %s: %r' % (svnpath, stderr)) - def svnpropget(self, path, prop, rev='HEAD'): - path = self.repo_path + '/' + path - path = util.normalize_url(fileurl(path)) - args = ['svn', 'propget', '-r', str(rev), prop, path] - p = subprocess.Popen(args, - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT) - stdout, stderr = p.communicate() - if p.returncode: - raise Exception('svn ls failed on %s: %r' % (path, stderr)) - return stdout.strip() - def commitchanges(self, changes, parent='tip', message='automated test'): """Commit changes to mercurial directory