devtools/testlib.py
changeset 10603 65ad6980976e
parent 10594 6a55853f14c9
child 10609 e2d8e81bfe68
--- a/devtools/testlib.py	Mon Sep 14 12:19:48 2015 +0200
+++ b/devtools/testlib.py	Tue Sep 22 09:39:30 2015 +0200
@@ -22,14 +22,14 @@
 
 import sys
 import re
-import urlparse
 from os.path import dirname, join, abspath
-from urllib import unquote
 from math import log
 from contextlib import contextmanager
 from warnings import warn
 from itertools import chain
 
+from six.moves.urllib.parse import urlparse, parse_qs, unquote as urlunquote
+
 import yams.schema
 
 from logilab.common.testlib import TestCase, InnerTest, Tags
@@ -736,8 +736,8 @@
         req = self.request(url=url)
         if isinstance(url, unicode):
             url = url.encode(req.encoding) # req.setup_params() expects encoded strings
-        querystring = urlparse.urlparse(url)[-2]
-        params = urlparse.parse_qs(querystring)
+        querystring = urlparse(url)[-2]
+        params = parse_qs(querystring)
         req.setup_params(params)
         return req
 
@@ -750,8 +750,8 @@
         with self.admin_access.web_request(url=url) as req:
             if isinstance(url, unicode):
                 url = url.encode(req.encoding) # req.setup_params() expects encoded strings
-            querystring = urlparse.urlparse(url)[-2]
-            params = urlparse.parse_qs(querystring)
+            querystring = urlparse(url)[-2]
+            params = parse_qs(querystring)
             req.setup_params(params)
             yield req
 
@@ -790,7 +790,7 @@
             path = location
             params = {}
         else:
-            cleanup = lambda p: (p[0], unquote(p[1]))
+            cleanup = lambda p: (p[0], urlunquote(p[1]))
             params = dict(cleanup(p.split('=', 1)) for p in params.split('&') if p)
         if path.startswith(req.base_url()): # may be relative
             path = path[len(req.base_url()):]