[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r1743591 - /subversion/trunk/build/run_tests.py

From: Branko ─îibej <brane_at_apache.org>
Date: Fri, 13 May 2016 05:03:02 +0200

On 13.05.2016 04:19, stefan2_at_apache.org wrote:
> Author: stefan2
> Date: Fri May 13 02:19:12 2016
> New Revision: 1743591
>
> URL: http://svn.apache.org/viewvc?rev=1743591&view=rev
> Log:
> Make our test runner locale independent in Python 3.
>
> Running our test suite with autodavcheck will change the environment
> such that text files default to ascii - causing some test scripts to
> fail upon loading.
>
> * build/run_tests.py
> (TestHarness._run_py_test): Explicitly load our tests as UTF-8 when
> supported. We can't load as binary here
> because Windows tests would fail miserably.
>
> 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=1743591&r1=1743590&r2=1743591&view=diff
> ==============================================================================
> --- subversion/trunk/build/run_tests.py (original)
> +++ subversion/trunk/build/run_tests.py Fri May 13 02:19:12 2016
> @@ -809,8 +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], open(progabs, 'r'), 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()

See, that's what I was talking about in the other post: if you'd just
used codecs.open() instead of open(), you wouldn't need the conditional
statement.

-- Brane
Received on 2016-05-13 05:09:48 CEST

This is an archived mail posted to the Subversion Dev mailing list.