[PATCH 3 of 8 v2] tests: make test-url use absolute_import

Pulkit Goyal 7895pulkit at gmail.com
Tue Apr 12 16:48:17 EDT 2016


# HG changeset patch
# User Pulkit Goyal <7895pulkit at gmail.com>
# Date 1460493503 -19800
#      Wed Apr 13 02:08:23 2016 +0530
# Node ID e473f4c9d30f8b98bb06fb7913d0fd31fc9d397e
# Parent  8111970b9a0dbb08cb6da59b0e79db0b4aedcdce
tests: make test-url use absolute_import

diff --git a/tests/test-check-py3-compat.t b/tests/test-check-py3-compat.t
--- a/tests/test-check-py3-compat.t
+++ b/tests/test-check-py3-compat.t
@@ -66,7 +66,6 @@
   tests/test-simplemerge.py not using absolute_import
   tests/test-symlink-os-yes-fs-no.py not using absolute_import
   tests/test-ui-color.py not using absolute_import
-  tests/test-url.py not using absolute_import
 
 #if py3exe
   $ hg files 'set:(**.py)' | sed 's|\\|/|g' | xargs $PYTHON3 contrib/check-py3-compat.py
diff --git a/tests/test-url.py b/tests/test-url.py
--- a/tests/test-url.py
+++ b/tests/test-url.py
@@ -1,4 +1,6 @@
-from __future__ import print_function
+from __future__ import absolute_import, print_function
+
+import doctest
 import os
 
 def check(a, b):
@@ -8,8 +10,11 @@
 def cert(cn):
     return {'subject': ((('commonName', cn),),)}
 
-from mercurial.sslutil import _verifycert
+from mercurial import (
+    sslutil,
+)
 
+_verifycert = sslutil._verifycert
 # Test non-wildcard certificates
 check(_verifycert(cert('example.com'), 'example.com'),
       None)
@@ -35,7 +40,7 @@
 check(_verifycert(san_cert, 'foo.example.net'),
       None)
 # no fallback to subject commonName when subjectAltName has DNS
-check(_verifycert(san_cert, 'example.com'),
+check(sslutil._verifycert(san_cert, 'example.com'),
       'certificate is for *.example.net, example.net')
 # fallback to subject commonName when no DNS in subjectAltName
 san_cert = {'subject': ((('commonName', 'example.com'),),),
@@ -58,8 +63,6 @@
 check(_verifycert(cert(u'\u4f8b.jp'), 'example.jp'),
       'IDN in certificate not supported')
 
-import doctest
-
 def test_url():
     """
     >>> from mercurial.util import url


More information about the Mercurial-devel mailing list