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

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

From: Branko ─îibej <brane_at_apache.org>
Date: Thu, 12 May 2016 22:20:24 +0200

On 12.05.2016 22:05, stefan2_at_apache.org wrote:
> Author: stefan2
> Date: Thu May 12 20:05:38 2016
> New Revision: 1743556
>
> URL: http://svn.apache.org/viewvc?rev=1743556&view=rev
> Log:
> Get the Python 3 tests running without the GLOBAL_SCHEDULER option.
>
> * build/run_tests.py
> (TestHarness._run_c_test.progress_func,
> TestHarness._run_py_test.progress_func,
> TestHarness._run_test): The log is binary data, so write byte strings
> to it.
>
> 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=1743556&r1=1743555&r2=1743556&view=diff
> ==============================================================================
> --- subversion/trunk/build/run_tests.py (original)
> +++ subversion/trunk/build/run_tests.py Thu May 12 20:05:38 2016
> @@ -781,7 +781,7 @@ class TestHarness:
> def progress_func(completed):
> if not self.log or self.dots_written >= dot_count:
> return
> - dots = (completed * dot_count) / total
> + dots = (int)((completed * dot_count) / total)

Really, a C-style cast in Python? :)

> if dots > dot_count:
> dots = dot_count
> dots_to_write = dots - self.dots_written
> @@ -834,7 +834,7 @@ class TestHarness:
> in parallel mode."""
> if not self.log:
> return
> - dots = (completed * dot_count) / total
> + dots = int((completed * dot_count) / total)
> if dots > dot_count:
> dots = dot_count
> self.progress_lock.acquire()

The correct way to do this in both Python 2.7 and Python3 is to write:

    dots = (completed * dot_count) // total

See: https://www.python.org/dev/peps/pep-0238/

-- Brane
Received on 2016-05-12 22:20:34 CEST

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