D3465: tests: make test-check-interfaces.py work on Python 3

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Tue May 8 04:26:35 UTC 2018


durin42 created this revision.
Herald added a reviewer: pulkit.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  1. skip-blame just a bunch of bytes prefixes

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3465

AFFECTED FILES
  contrib/python3-whitelist
  tests/test-check-interfaces.py

CHANGE DETAILS

diff --git a/tests/test-check-interfaces.py b/tests/test-check-interfaces.py
--- a/tests/test-check-interfaces.py
+++ b/tests/test-check-interfaces.py
@@ -25,6 +25,7 @@
     filelog,
     httppeer,
     localrepo,
+    pycompat,
     repository,
     sshpeer,
     statichttprepo,
@@ -37,7 +38,8 @@
     wireprotov2server,
 )
 
-rootdir = os.path.normpath(os.path.join(os.path.dirname(__file__), '..'))
+rootdir = pycompat.fsencode(
+    os.path.normpath(os.path.join(os.path.dirname(__file__), '..')))
 
 def checkzobject(o, allowextra=False):
     """Verify an object with a zope interface."""
@@ -106,7 +108,7 @@
                          httppeer.httpv2peer)
     ziverify.verifyClass(repository.ipeercapabilities,
                          httppeer.httpv2peer)
-    checkzobject(httppeer.httpv2peer(None, '', None, None, None, None))
+    checkzobject(httppeer.httpv2peer(None, b'', b'', None, None, None))
 
     ziverify.verifyClass(repository.ipeerbase,
                          localrepo.localpeer)
@@ -121,11 +123,11 @@
     checkzobject(wireprotov1peer.peerexecutor(None))
 
     ziverify.verifyClass(repository.ipeerbase, sshpeer.sshv1peer)
-    checkzobject(sshpeer.sshv1peer(ui, 'ssh://localhost/foo', None, dummypipe(),
+    checkzobject(sshpeer.sshv1peer(ui, b'ssh://localhost/foo', b'', dummypipe(),
                                    dummypipe(), None, None))
 
     ziverify.verifyClass(repository.ipeerbase, sshpeer.sshv2peer)
-    checkzobject(sshpeer.sshv2peer(ui, 'ssh://localhost/foo', None, dummypipe(),
+    checkzobject(sshpeer.sshv2peer(ui, b'ssh://localhost/foo', b'', dummypipe(),
                                    dummypipe(), None, None))
 
     ziverify.verifyClass(repository.ipeerbase, bundlerepo.bundlepeer)
@@ -163,8 +165,8 @@
 
     ziverify.verifyClass(repository.ifilestorage, filelog.filelog)
 
-    vfs = vfsmod.vfs('.')
-    fl = filelog.filelog(vfs, 'dummy.i')
+    vfs = vfsmod.vfs(b'.')
+    fl = filelog.filelog(vfs, b'dummy.i')
     checkzobject(fl, allowextra=True)
 
 main()
diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -40,6 +40,7 @@
 test-changelog-exec.t
 test-check-commit.t
 test-check-execute.t
+test-check-interfaces.py
 test-check-module-imports.t
 test-check-pyflakes.t
 test-check-pylint.t



To: durin42, pulkit, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list