[testutils] add a 'local' argument to ApycotBaseTC.hgrepo() draft
authorDavid Douard <david.douard@logilab.fr>
Sun, 26 Oct 2014 15:41:11 +0100
changeset 1764 8473295c50b1
parent 1763 651dcc558568
child 1765 3c579657557f
[testutils] add a 'local' argument to ApycotBaseTC.hgrepo() set it to False to use repo.source_url instead of repo.local_cache
testutils.py
--- a/testutils.py	Sun Oct 26 15:39:10 2014 +0100
+++ b/testutils.py	Sun Oct 26 15:41:11 2014 +0100
@@ -232,9 +232,14 @@
         if setend:
             cnx.execute('SET X status "success" '
                         'WHERE X eid %(x)s', {'x': ex.eid})
-    def hgrepo(self, reponame):
+
+    def hgrepo(self, reponame, local=True):
         with self.admin_access.repo_cnx() as cnx:
-            repopath = cnx.find('Repository', title=reponame).one().localcachepath
+            repo = cnx.find('Repository', title=reponame).one()
+            if local:
+                repopath = repo.localcachepath
+            else:
+                repopath = repo.source_url
         return hgopen(repopath)
 
     def refresh(self):