tests: support URL quoting on Python 3
authorGregory Szorc <gregory.szorc@gmail.com>
Wed, 23 Jan 2019 17:57:43 -0800
changeset 41330 d5c58d679ed9
parent 41329 84707d9e77a0
child 41331 56a0de3d581c
tests: support URL quoting on Python 3 We could use mercurial.urllibcompat, but meh. This makes things easier to read. The test still fails on Python 3 for some reason. But at least we no longer have an exception. Differential Revision: https://phab.mercurial-scm.org/D5669
tests/test-mq-subrepo-svn.t
--- a/tests/test-mq-subrepo-svn.t	Wed Jan 23 17:45:11 2019 -0800
+++ b/tests/test-mq-subrepo-svn.t	Wed Jan 23 17:57:43 2019 -0800
@@ -23,10 +23,17 @@
   $ svnadmin create svn-repo-2499
 
   $ SVNREPOPATH=`pwd`/svn-repo-2499/project
+
+#if py3
+  $ pathquoted=`"$PYTHON" -c "import sys, urllib.parse; sys.stdout.write(urllib.parse.quote(sys.argv[1]))" "$SVNREPOPATH"`
+#else
+  $ pathquoted=`"$PYTHON" -c "import sys, urllib; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
+#endif
+
 #if windows
-  $ SVNREPOURL=file:///`"$PYTHON" -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
+  $ SVNREPOURL=file:///$pathquoted
 #else
-  $ SVNREPOURL=file://`"$PYTHON" -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
+  $ SVNREPOURL=file://$pathquoted
 #endif
 
   $ mkdir -p svn-project-2499/trunk