[PATCH 5 of 5] tests: test-archive.t use mercurial.util for urllib compat

timeless timeless at fmr.im
Wed May 11 01:21:06 EDT 2016


# HG changeset patch
# User timeless <timeless at mozdev.org>
# Date 1462562665 0
#      Fri May 06 19:24:25 2016 +0000
# Node ID 401c5c11d34ffc7dc226bffe5612ba9bcdc686b7
# Parent  a76f8fe3523dcf1cca1111e7311579bf11f420c2
# EXP-Topic runtests
# Available At bb://timeless/mercurial-crew
#              hg pull bb://timeless/mercurial-crew -r 401c5c11d34f
tests: test-archive.t use mercurial.util for urllib compat

diff -r a76f8fe3523d -r 401c5c11d34f tests/test-archive.t
--- a/tests/test-archive.t	Fri May 06 19:19:12 2016 +0000
+++ b/tests/test-archive.t	Fri May 06 19:24:25 2016 +0000
@@ -72,7 +72,9 @@
   > from __future__ import absolute_import
   > import os
   > import sys
-  > import urllib2
+  > from mercurial import (
+  >     util,
+  > )
   > try:
   >     # Set stdout to binary mode for win32 platforms
   >     import msvcrt
@@ -90,10 +92,10 @@
   > except AttributeError:
   >     stdout = sys.stdout
   > try:
-  >     f = urllib2.urlopen('http://127.0.0.1:%s/?%s'
+  >     f = util.urlreq.urlopen('http://127.0.0.1:%s/?%s'
   >                     % (os.environ['HGPORT'], requeststr))
   >     stdout.write(f.read())
-  > except urllib2.HTTPError, e:
+  > except util.urlerr.httperror as e:
   >     sys.stderr.write(str(e) + '\n')
   > EOF
   $ python getarchive.py "$TIP" gz | gunzip | tar tf - 2>/dev/null


More information about the Mercurial-devel mailing list