subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1743957 - /subversion/trunk/build/run_tests.py
Date Sun, 15 May 2016 19:31:31 GMT
Author: stefan2
Date: Sun May 15 19:31:31 2016
New Revision: 1743957

URL: http://svn.apache.org/viewvc?rev=1743957&view=rev
Log:
Revert r1743947. Python 2 requires a plain file object
to be passed to imp.load_module.

Modified:
    subversion/trunk/build/run_tests.py

Modified: subversion/trunk/build/run_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/build/run_tests.py?rev=1743957&r1=1743956&r2=1743957&view=diff
==============================================================================
--- subversion/trunk/build/run_tests.py (original)
+++ subversion/trunk/build/run_tests.py Sun May 15 19:31:31 2016
@@ -45,7 +45,7 @@ and filename of a test program, optional
 separated list of test numbers; the default is to run all the tests in it.
 '''
 
-import os, sys, shutil, codecs
+import os, sys, shutil
 import re
 import logging
 import optparse, subprocess, imp, threading, traceback
@@ -809,9 +809,13 @@ class TestHarness:
   def _run_py_test(self, progabs, progdir, progbase, test_nums, dot_count):
     'Run a python test, passing parameters as needed.'
     try:
-      prog_mod = imp.load_module(progbase[:-3],
-                                 codecs.open(progabs, 'r', encoding="utf-8"),
-                                 progabs, ('.py', 'U', imp.PY_SOURCE))
+      if sys.version_info < (3, 0):
+        prog_mod = imp.load_module(progbase[:-3], open(progabs, 'r'), progabs,
+                                   ('.py', 'U', imp.PY_SOURCE))
+      else:
+        prog_mod = imp.load_module(progbase[:-3],
+                                   open(progabs, 'r', encoding="utf-8"),
+                                   progabs, ('.py', 'U', imp.PY_SOURCE))
     except:
       print("\nError loading test (details in following traceback): " + progbase)
       traceback.print_exc()



Mime
View raw message