changeset 1035:fa08148bc5fc

git_handler: use namedtuple as mock repo in doctests The tests were broken by 715cbf3fa24c with the switch to using repo.vfs, but this was masked by the fact that the Makefile is only set to run tests for git2hg.py. We'll tackle that in an upcoming changeset.
author Kevin Bullock <kbullock@ringworld.org>
date Sat, 05 Aug 2017 17:03:33 -0500
parents ada8dba23fd0
children cfcd3032355c
files hggit/git_handler.py
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hggit/git_handler.py
+++ b/hggit/git_handler.py
@@ -616,8 +616,11 @@
 
         TESTS:
 
+        >>> from collections import namedtuple
         >>> from mercurial.ui import ui
-        >>> g = GitHandler('', ui()).get_valid_git_username_email
+        >>> mockrepo = namedtuple('localrepo', ['vfs'])
+        >>> mockrepo.vfs = ''
+        >>> g = GitHandler(mockrepo, ui()).get_valid_git_username_email
         >>> g('John Doe')
         'John Doe'
         >>> g('john@doe.com')
@@ -1642,9 +1645,12 @@
 
         Tests:
 
+        >>> from collections import namedtuple
         >>> from dulwich.client import HttpGitClient, SSHGitClient
         >>> from mercurial.ui import ui
-        >>> g = GitHandler('', ui())
+        >>> mockrepo = namedtuple('localrepo', ['vfs'])
+        >>> mockrepo.vfs = ''
+        >>> g = GitHandler(mockrepo, ui())
         >>> client, url = g.get_transport_and_path('http://fqdn.com/test.git')
         >>> print isinstance(client, HttpGitClient)
         True