diff hggit/git_handler.py @ 1034: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 e7a8a5710257
children cfcd3032355c
line wrap: on
line diff
--- a/hggit/git_handler.py	Mon Jul 24 16:06:25 2017 -0500
+++ b/hggit/git_handler.py	Sat Aug 05 17:03:33 2017 -0500
@@ -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