subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1742817 - in /subversion/trunk/subversion/tests/cmdline: lock_tests.py mod_authz_svn_tests.py mod_dav_svn_tests.py svntest/main.py svntest/wc.py
Date Sun, 08 May 2016 13:42:29 GMT
Author: stefan2
Date: Sun May  8 13:42:28 2016
New Revision: 1742817

URL: http://svn.apache.org/viewvc?rev=1742817&view=rev
Log:
In our build and test scripts, replace Python 2 -only imports by pairs
of Python 2 / 3 alternative imports.

* subversion/tests/cmdline/lock_tests.py
  (dav_lock_refresh):  The httplib module has been replaced in Python 3
                       by http.client.

* subversion/tests/cmdline/mod_dav_svn_tests.py
  (): Same.

* subversion/tests/cmdline/mod_authz_svn_tests.py
  (verify_get): Same, also for urlparse vs. urllib.parse.

* subversion/tests/cmdline/svntest/main.py
  (): The urlparse module has been replaced by the urllib.parse in Python 3.
  (create_http_connection):  Remove redundant urlparse import and replace
                             the httplib import with the respective
                             alternative import pair.

* subversion/tests/cmdline/svntest/wc.py
  (): The quote function has been moved to urllib.parse, so provide an
      alias for it.
  (svn_uri_quote): Use the function alias.

Modified:
    subversion/trunk/subversion/tests/cmdline/lock_tests.py
    subversion/trunk/subversion/tests/cmdline/mod_authz_svn_tests.py
    subversion/trunk/subversion/tests/cmdline/mod_dav_svn_tests.py
    subversion/trunk/subversion/tests/cmdline/svntest/main.py
    subversion/trunk/subversion/tests/cmdline/svntest/wc.py

Modified: subversion/trunk/subversion/tests/cmdline/lock_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/lock_tests.py?rev=1742817&r1=1742816&r2=1742817&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/lock_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/lock_tests.py Sun May  8 13:42:28 2016
@@ -2216,7 +2216,13 @@ def many_locks_hooks(sbox):
 def dav_lock_refresh(sbox):
   "refresh timeout of DAV lock"
 
-  import httplib
+  if sys.version_info < (3, 0):
+    # Python <3.0
+    import httplib
+  else:
+    # Python >=3.0
+    import http.client
+
   import base64
 
   sbox.build(create_wc = False)

Modified: subversion/trunk/subversion/tests/cmdline/mod_authz_svn_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/mod_authz_svn_tests.py?rev=1742817&r1=1742816&r2=1742817&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/mod_authz_svn_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/mod_authz_svn_tests.py Sun May  8 13:42:28 2016
@@ -101,8 +101,15 @@ def write_authz_file_groups(sbox):
 
 def verify_get(test_area_url, path, user, pw,
                expected_status, expected_body, headers):
-  import httplib
-  from urlparse import urlparse
+  if sys.version_info < (3, 0):
+    # Python <3.0
+    import httplib
+    from urlparse import urlparse
+  else:
+    # Python >=3.0
+    import http.client
+    from urllib.parse import urlparse
+
   import base64
 
   req_url = test_area_url + path

Modified: subversion/trunk/subversion/tests/cmdline/mod_dav_svn_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/mod_dav_svn_tests.py?rev=1742817&r1=1742816&r2=1742817&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/mod_dav_svn_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/mod_dav_svn_tests.py Sun May  8 13:42:28 2016
@@ -25,7 +25,14 @@
 ######################################################################
 
 # General modules
-import os, logging, httplib, base64
+import os, logging, base64
+
+try:
+  # Python <3.0
+  import httplib
+except ImportError:
+  # Python >=3.0
+  import http.client
 
 logger = logging.getLogger()
 

Modified: subversion/trunk/subversion/tests/cmdline/svntest/main.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/main.py?rev=1742817&r1=1742816&r2=1742817&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/main.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/main.py Sun May  8 13:42:28 2016
@@ -37,18 +37,19 @@ import urllib
 import logging
 import hashlib
 import zipfile
-from urlparse import urlparse
 
 try:
   # Python >=3.0
   import queue
   from urllib.parse import quote as urllib_parse_quote
   from urllib.parse import unquote as urllib_parse_unquote
+  from urllib.parse import urlparse
 except ImportError:
   # Python <3.0
   import Queue as queue
   from urllib import quote as urllib_parse_quote
   from urllib import unquote as urllib_parse_unquote
+  from urlparse import urlparse
 
 import svntest
 from svntest import Failure
@@ -1206,8 +1207,12 @@ def create_http_connection(url, debuglev
      working with this connection) to DEBUGLEVEL.  By default, all debugging
      output is printed. """
 
-  import httplib
-  from urlparse import urlparse
+  if sys.version_info < (3, 0):
+    # Python <3.0
+    import httplib
+  else:
+    # Python >=3.0
+    import http.client
 
   loc = urlparse(url)
   if loc.scheme == 'http':

Modified: subversion/trunk/subversion/tests/cmdline/svntest/wc.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/wc.py?rev=1742817&r1=1742816&r2=1742817&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/wc.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/wc.py Sun May  8 13:42:28 2016
@@ -26,16 +26,17 @@
 import os
 import sys
 import re
-import urllib
 import logging
 import pprint
 
 if sys.version_info[0] >= 3:
   # Python >=3.0
   from io import StringIO
+  from urllib.parse import quote as urllib_quote
 else:
   # Python <3.0
   from cStringIO import StringIO
+  from urllib import quote as urllib_quote
 
 import svntest
 
@@ -1073,7 +1074,7 @@ def repos_join(base, path):
 def svn_uri_quote(url):
   # svn defines a different set of "safe" characters than Python does, so
   # we need to avoid escaping them. see subr/path.c:uri_char_validity[]
-  return urllib.quote(url, "!$&'()*+,-./:=@_~")
+  return urllib_quote(url, "!$&'()*+,-./:=@_~")
 
 
 # ------------



Mime
View raw message