subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1743081 - /subversion/trunk/subversion/tests/cmdline/svntest/main.py
Date Mon, 09 May 2016 23:10:38 GMT
Author: stefan2
Date: Mon May  9 23:10:38 2016
New Revision: 1743081

URL: http://svn.apache.org/viewvc?rev=1743081&view=rev
Log:
Make over 90% of the tests succeed with Python 3.

* subversion/tests/cmdline/svntest/main.py
  (filter_dbg): Program output may be either strings or binaries.
                Make filtering work in both cases.
  (run_command_stdin): Update caller.
  (copy_repos): Dump streams are binary.

Modified:
    subversion/trunk/subversion/tests/cmdline/svntest/main.py

Modified: subversion/trunk/subversion/tests/cmdline/svntest/main.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/main.py?rev=1743081&r1=1743080&r2=1743081&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/main.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/main.py Mon May  9 23:10:38 2016
@@ -382,9 +382,15 @@ def ensure_list(item):
   else:
     return list(item)
 
-def filter_dbg(lines):
-  excluded = filter(lambda line: line.startswith('DBG:'), lines)
-  included = filter(lambda line: not line.startswith('DBG:'), lines)
+def filter_dbg(lines, binary = False):
+  if binary:
+    excluded = filter(lambda line: line.startswith(b'DBG:'), lines)
+    excluded = map(bytes.decode, excluded)
+    included = filter(lambda line: not line.startswith(b'DBG:'), lines)
+  else:
+    excluded = filter(lambda line: line.startswith('DBG:'), lines)
+    included = filter(lambda line: not line.startswith('DBG:'), lines)
+
   sys.stdout.write(''.join(excluded))
   return ensure_list(included)
 
@@ -609,7 +615,7 @@ def run_command_stdin(command, error_exp
                   '"; exit code ' + str(exit_code))
 
   return exit_code, \
-         filter_dbg(stdout_lines), \
+         filter_dbg(stdout_lines, binary_mode), \
          stderr_lines
 
 def create_config_dir(cfgdir, config_contents=None, server_contents=None,
@@ -1198,12 +1204,12 @@ def copy_repos(src_path, dst_path, head_
     logger.warn('ERROR:  dump failed; did not see revision %s', head_revision)
     raise SVNRepositoryCopyFailure
 
-  load_re = re.compile(r'^------- Committed revision (\d+) >>>\r?$')
+  load_re = re.compile(b'^------- Committed revision (\\d+) >>>\\r?$')
   expect_revision = 1
-  for load_line in filter_dbg(load_stdout):
+  for load_line in filter_dbg(load_stdout, True):
     match = load_re.match(load_line)
     if match:
-      if match.group(1) != str(expect_revision):
+      if match.group(1).decode() != str(expect_revision):
         logger.warn('ERROR:  load failed: %s', load_line.strip())
         raise SVNRepositoryCopyFailure
       expect_revision += 1



Mime
View raw message