tests: make test-check-interfaces.py work on Python 3
authorAugie Fackler <augie@google.com>
Thu, 26 Apr 2018 21:39:35 -0400
changeset 37870 39c17718f311
parent 37869 73a74f29eb87
child 37871 6574c81b6831
tests: make test-check-interfaces.py work on Python 3 # skip-blame just a bunch of bytes prefixes Differential Revision: https://phab.mercurial-scm.org/D3465
contrib/python3-whitelist
tests/test-check-interfaces.py
--- a/contrib/python3-whitelist	Thu Apr 26 21:38:49 2018 -0400
+++ b/contrib/python3-whitelist	Thu Apr 26 21:39:35 2018 -0400
@@ -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
--- a/tests/test-check-interfaces.py	Thu Apr 26 21:38:49 2018 -0400
+++ b/tests/test-check-interfaces.py	Thu Apr 26 21:39:35 2018 -0400
@@ -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()