Patchwork D3474: tests: port test-hgwebdir-paths.py to Python 3

login
register
mail settings
Submitter phabricator
Date May 8, 2018, 4:27 a.m.
Message ID <differential-rev-PHID-DREV-hppt3zz5m75vondxknwb-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/31327/
State Superseded
Headers show

Comments

phabricator - May 8, 2018, 4:27 a.m.
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 b prefixes, nothing interesting

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/python3-whitelist
  tests/test-hgwebdir-paths.py

CHANGE DETAILS




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

Patch

diff --git a/tests/test-hgwebdir-paths.py b/tests/test-hgwebdir-paths.py
--- a/tests/test-hgwebdir-paths.py
+++ b/tests/test-hgwebdir-paths.py
@@ -10,30 +10,30 @@ 
 )
 hgwebdir = hgwebdir_mod.hgwebdir
 
-os.mkdir('webdir')
-os.chdir('webdir')
+os.mkdir(b'webdir')
+os.chdir(b'webdir')
 
-webdir = os.path.realpath('.')
+webdir = os.path.realpath(b'.')
 
 u = uimod.ui.load()
-hg.repository(u, 'a', create=1)
-hg.repository(u, 'b', create=1)
-os.chdir('b')
-hg.repository(u, 'd', create=1)
-os.chdir('..')
-hg.repository(u, 'c', create=1)
-os.chdir('..')
+hg.repository(u, b'a', create=1)
+hg.repository(u, b'b', create=1)
+os.chdir(b'b')
+hg.repository(u, b'd', create=1)
+os.chdir(b'..')
+hg.repository(u, b'c', create=1)
+os.chdir(b'..')
 
-paths = {'t/a/': '%s/a' % webdir,
-         'b': '%s/b' % webdir,
-         'coll': '%s/*' % webdir,
-         'rcoll': '%s/**' % webdir}
+paths = {b't/a/': b'%s/a' % webdir,
+         b'b': b'%s/b' % webdir,
+         b'coll': b'%s/*' % webdir,
+         b'rcoll': b'%s/**' % webdir}
 
-config = os.path.join(webdir, 'hgwebdir.conf')
-configfile = open(config, 'w')
-configfile.write('[paths]\n')
+config = os.path.join(webdir, b'hgwebdir.conf')
+configfile = open(config, 'wb')
+configfile.write(b'[paths]\n')
 for k, v in paths.items():
-    configfile.write('%s = %s\n' % (k, v))
+    configfile.write(b'%s = %s\n' % (k, v))
 configfile.close()
 
 confwd = hgwebdir(config)
diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -163,6 +163,7 @@ 
 test-hgweb-descend-empties.t
 test-hgweb-empty.t
 test-hgweb-removed.t
+test-hgwebdir-paths.py
 test-hgwebdirsym.t
 test-histedit-arguments.t
 test-histedit-base.t