You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Branko Čibej <br...@apache.org> on 2016/05/12 20:20:24 UTC

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

On 12.05.2016 22:05, stefan2@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

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

Posted by Stefan Fuhrmann <st...@apache.org>.
On 12.05.2016 22:20, Branko \u010cibej wrote:
> On 12.05.2016 22:05, stefan2@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? :)
Yeah, well ... ;)

>>         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/
Didn't know that was a thing. Changed in r1743595.

-- Stefan^2.