changeset 871:51fd75ae62b9

test_util: pass repo_path to svnpropget(), turn into a function
author Patrick Mezard <patrick@mezard.eu>
date Thu, 19 Apr 2012 18:29:31 +0200
parents 1eb2a4428c42
children a279b5838aaf
files tests/test_single_dir_clone.py tests/test_util.py
diffstat 2 files changed, 16 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- 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',
--- 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