subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1664997 - in /subversion/trunk/subversion/tests/cmdline: svnsync_authz_tests.py svnsync_tests.py svntest/main.py svntest/sandbox.py
Date Sun, 08 Mar 2015 14:29:26 GMT
Author: rhuijben
Date: Sun Mar  8 14:29:26 2015
New Revision: 1664997

URL: http://svn.apache.org/r1664997
Log:
Fix test failures when running from a directory whose name contains characters
which must be escaped in a URL. This is a regression caused by the new stricter
dump file parsing.

Subversion has its own rules about which characters needs escaping and as
we expect them to exactly match in test results we can't just use urllib
to perform the path escaping for us.

Found by: James McCoy <jamessan{_AT_}debian.org>
(The original patch broke the test framework on Windows and I decided to add a
 helper function instead of duplicating the same code in a few tests).

* subversion/tests/cmdline/svnsync_authz_tests.py
  (imports): Remove unneeded import.
  (copy_delete_unreadable_child): Update usage.

* subversion/tests/cmdline/svnsync_tests.py
  (imports): Remove unneeded import.
  (setup_and_sync): Update usage.

* subversion/tests/cmdline/svntest/main.py
  (file_scheme_prefix): Tweak Windows value.
  (_create_parser, execute_tests): Use svntest.wc.svn_uri_quote

* subversion/tests/cmdline/svntest/sandbox.py
  (imports): Remove unneeded import.
  (_set_name,
   add_repo_path): Use svntest.wc.svn_uri_quote
  (file_protocol_url): New function.

Modified:
    subversion/trunk/subversion/tests/cmdline/svnsync_authz_tests.py
    subversion/trunk/subversion/tests/cmdline/svnsync_tests.py
    subversion/trunk/subversion/tests/cmdline/svntest/main.py
    subversion/trunk/subversion/tests/cmdline/svntest/sandbox.py

Modified: subversion/trunk/subversion/tests/cmdline/svnsync_authz_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svnsync_authz_tests.py?rev=1664997&r1=1664996&r2=1664997&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svnsync_authz_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svnsync_authz_tests.py Sun Mar  8 14:29:26 2015
@@ -30,7 +30,7 @@
 import sys, os
 
 # Test suite-specific modules
-import locale, re, urllib
+import locale, re
 
 # Our testing module
 import svntest
@@ -471,8 +471,7 @@ def copy_delete_unreadable_child(sbox):
                        src_authz + ':/A': '* =',
                        })
 
-  dest_url = svntest.main.file_scheme_prefix \
-                    + urllib.pathname2url(os.path.abspath(dest_sbox.repo_dir))
+  dest_url = dest_sbox.file_protocol_url()
   run_init(dest_url, sbox.repo_url)
   run_sync(dest_url)
 

Modified: subversion/trunk/subversion/tests/cmdline/svnsync_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svnsync_tests.py?rev=1664997&r1=1664996&r2=1664997&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svnsync_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svnsync_tests.py Sun Mar  8 14:29:26 2015
@@ -28,7 +28,7 @@
 import sys, os
 
 # Test suite-specific modules
-import re, urllib
+import re
 
 # Our testing module
 import svntest
@@ -131,16 +131,14 @@ def setup_and_sync(sbox, dump_file_conte
   repo_url = sbox.repo_url
   cwd = os.getcwd()
   if is_src_ra_local:
-    repo_url = svntest.main.file_scheme_prefix + \
-                        urllib.pathname2url(os.path.join(cwd, sbox.repo_dir))
+    repo_url = sbox.file_protocol_url()
 
   if subdir:
     repo_url = repo_url + subdir
 
   dest_repo_url = dest_sbox.repo_url
   if is_dest_ra_local:
-    dest_repo_url = svntest.main.file_scheme_prefix + \
-                    urllib.pathname2url(os.path.join(cwd, dest_sbox.repo_dir))
+    dest_repo_url = dest_sbox.file_protocol_url()
   run_init(dest_repo_url, repo_url, source_prop_encoding)
 
   run_sync(dest_repo_url, repo_url,

Modified: subversion/trunk/subversion/tests/cmdline/svntest/main.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/main.py?rev=1664997&r1=1664996&r2=1664997&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/main.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/main.py Sun Mar  8 14:29:26 2015
@@ -112,7 +112,7 @@ class SVNRepositoryCreateFailure(Failure
 # Windows specifics
 if sys.platform == 'win32':
   windows = True
-  file_scheme_prefix = 'file:'
+  file_scheme_prefix = 'file:///'
   _exe = '.exe'
   _bat = '.bat'
   os.environ['SVN_DBG_STACKTRACES_TO_STDERR'] = 'y'
@@ -1980,7 +1980,9 @@ def _create_parser():
   parser.set_defaults(
         server_minor_version=SVN_VER_MINOR,
         url=file_scheme_prefix + \
-                        urllib.pathname2url(os.path.abspath(os.getcwd())),
+                        svntest.wc.svn_uri_quote(
+                           os.path.abspath(
+                               os.getcwd()).replace(os.path.sep, '/')),
         http_library=_default_http_library)
 
   return parser
@@ -2229,7 +2231,9 @@ def execute_tests(test_list, serial_only
 
   # Calculate pristine_greek_repos_url from test_area_url.
   pristine_greek_repos_url = options.test_area_url + '/' + \
-                                urllib.pathname2url(pristine_greek_repos_dir)
+                                svntest.wc.svn_uri_quote(
+                                  pristine_greek_repos_dir.replace(
+                                      os.path.sep, '/'))
 
   if options.use_jsvn:
     if options.svn_bin is None:

Modified: subversion/trunk/subversion/tests/cmdline/svntest/sandbox.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/sandbox.py?rev=1664997&r1=1664996&r2=1664997&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/sandbox.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/sandbox.py Sun Mar  8 14:29:26 2015
@@ -24,7 +24,6 @@
 import os
 import shutil
 import copy
-import urllib
 import logging
 import re
 
@@ -114,7 +113,8 @@ class Sandbox:
     if empty or not read_only:  # use a local repo
       self.repo_dir = os.path.join(svntest.main.general_repo_dir, self.name)
       self.repo_url = (svntest.main.options.test_area_url + '/'
-                       + urllib.pathname2url(self.repo_dir))
+                       + svntest.wc.svn_uri_quote(
+                                self.repo_dir.replace(os.path.sep, '/')))
       self.add_test_path(self.repo_dir)
     else:
       self.repo_dir = svntest.main.pristine_greek_repos_dir
@@ -195,7 +195,8 @@ class Sandbox:
     path = (os.path.join(svntest.main.general_repo_dir, self.name)
             + '.' + suffix)
     url = svntest.main.options.test_area_url + \
-                                        '/' + urllib.pathname2url(path)
+                                        '/' + svntest.wc.svn_uri_quote(
+                                                path.replace(os.path.sep, '/'))
     self.add_test_path(path, remove)
     return path, url
 
@@ -276,6 +277,12 @@ class Sandbox:
                                   temporary and 'TEMP' or 'PERM',
                                   parts[1])
 
+  def file_protocol_url(self):
+    """get a file:// url pointing to the repository"""
+    return svntest.main.file_scheme_prefix + \
+           svntest.wc.svn_uri_quote(
+                os.path.abspath(self.repo_dir).replace(os.path.sep, '/'))
+
   def simple_update(self, target=None, revision='HEAD'):
     """Update the WC or TARGET.
        TARGET is a relpath relative to the WC."""



Mime
View raw message