You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by fu...@apache.org on 2019/09/28 15:27:21 UTC

svn commit: r1867679 - /subversion/branches/swig-py3/subversion/bindings/swig/python/tests/utils.py

Author: futatuki
Date: Sat Sep 28 15:27:20 2019
New Revision: 1867679

URL: http://svn.apache.org/viewvc?rev=1867679&view=rev
Log:
On branch swig-py3: A follow-up to 1867653:  Keep simple code in conditional
block

* subversion/bindings/swig/python/tests/utils.py (file_uri_for_path):
  Factor out call of pathname2url() into out of conditional block.

Patched by: brane

Modified:
    subversion/branches/swig-py3/subversion/bindings/swig/python/tests/utils.py

Modified: subversion/branches/swig-py3/subversion/bindings/swig/python/tests/utils.py
URL: http://svn.apache.org/viewvc/subversion/branches/swig-py3/subversion/bindings/swig/python/tests/utils.py?rev=1867679&r1=1867678&r2=1867679&view=diff
==============================================================================
--- subversion/branches/swig-py3/subversion/bindings/swig/python/tests/utils.py (original)
+++ subversion/branches/swig-py3/subversion/bindings/swig/python/tests/utils.py Sat Sep 28 15:27:20 2019
@@ -80,9 +80,8 @@ class Temper(object):
 def file_uri_for_path(path):
   """Return the file: URI corresponding to the given path."""
   if isinstance(path, str):
-    uri_path = pathname2url(path).encode('UTF-8')
-  else:
-    uri_path = pathname2url(path.decode('UTF-8')).encode('UTF-8')
+    path = path.decode('UTF-8')
+  uri_path = pathname2url(path).encode('UTF-8')
 
   # pathname2url claims to return the path part of the URI, but on Windows
   # it returns both the authority and path parts for no reason, which



Re: svn commit: r1867679 - /subversion/branches/swig-py3/subversion/bindings/swig/python/tests/utils.py

Posted by Yasuhito FUTATSUKI <fu...@poem.co.jp>.
On 2019/09/29 23:16, Johan Corveleyn wrote:
> On Sat, Sep 28, 2019 at 5:27 PM <fu...@apache.org> wrote:
>>
>> Author: futatuki
>> Date: Sat Sep 28 15:27:20 2019
>> New Revision: 1867679
>>
>> URL: http://svn.apache.org/viewvc?rev=1867679&view=rev
>> Log:
>> On branch swig-py3: A follow-up to 1867653:  Keep simple code in conditional
>> block
>>
>> * subversion/bindings/swig/python/tests/utils.py (file_uri_for_path):
>>    Factor out call of pathname2url() into out of conditional block.
>>
>> Patched by: brane
>>
>> Modified:
>>      subversion/branches/swig-py3/subversion/bindings/swig/python/tests/utils.py
>>
>> Modified: subversion/branches/swig-py3/subversion/bindings/swig/python/tests/utils.py
>> URL: http://svn.apache.org/viewvc/subversion/branches/swig-py3/subversion/bindings/swig/python/tests/utils.py?rev=1867679&r1=1867678&r2=1867679&view=diff
>> ==============================================================================
>> --- subversion/branches/swig-py3/subversion/bindings/swig/python/tests/utils.py (original)
>> +++ subversion/branches/swig-py3/subversion/bindings/swig/python/tests/utils.py Sat Sep 28 15:27:20 2019
>> @@ -80,9 +80,8 @@ class Temper(object):
>>   def file_uri_for_path(path):
>>     """Return the file: URI corresponding to the given path."""
>>     if isinstance(path, str):
>> -    uri_path = pathname2url(path).encode('UTF-8')
>> -  else:
>> -    uri_path = pathname2url(path.decode('UTF-8')).encode('UTF-8')
>> +    path = path.decode('UTF-8')
>> +  uri_path = pathname2url(path).encode('UTF-8')
>>
>>     # pathname2url claims to return the path part of the URI, but on Windows
>>     # it returns both the authority and path parts for no reason, which
> 
> That doesn't seem to work correctly. Now I get a lot more errors :-).

Ah, its condition is contrary! And this affects only Windows environment.
  
> [[[
> ...
> ERROR: test_unnamed_editor (repository.SubversionRepositoryTestCase)
> Test editor object without reference from interpreter
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>    File "C:\research\svn\dev\swig-py3\subversion\bindings\swig\python\tests\repository.py",
> line 89, in setUp
>      'trac/versioncontrol/tests/svnrepos.dump', suffix='-repository')
>    File "C:\research\svn\dev\swig-py3\subversion\bindings\swig\python\tests\utils.py",
> line 74, in alloc_known_repo
>      (handle, repo_path, repo_uri) = self.alloc_empty_repo(suffix=suffix)
>    File "C:\research\svn\dev\swig-py3\subversion\bindings\swig\python\tests\utils.py",
> line 64, in alloc_empty_repo
>      repo_uri = core.svn_uri_canonicalize(file_uri_for_path(temp_path))
>    File "C:\research\svn\dev\swig-py3\subversion\bindings\swig\python\tests\utils.py",
> line 84, in file_uri_for_path
>      uri_path = pathname2url(path).encode('UTF-8')
>    File "C:\Python37\lib\nturl2path.py", line 53, in pathname2url
>      if not ':' in p:
> TypeError: a bytes-like object is required, not 'str'
> 
> ----------------------------------------------------------------------
> Ran 153 tests in 2.007s
> 
> FAILED (errors=87)
> [Test runner reported failure]
> ]]]
> 
> 
Thank you for your report.

-- 
Yasuhito FUTATSUKI <fu...@poem.co.jp>

Re: svn commit: r1867679 - /subversion/branches/swig-py3/subversion/bindings/swig/python/tests/utils.py

Posted by Johan Corveleyn <jc...@gmail.com>.
On Sat, Sep 28, 2019 at 5:27 PM <fu...@apache.org> wrote:
>
> Author: futatuki
> Date: Sat Sep 28 15:27:20 2019
> New Revision: 1867679
>
> URL: http://svn.apache.org/viewvc?rev=1867679&view=rev
> Log:
> On branch swig-py3: A follow-up to 1867653:  Keep simple code in conditional
> block
>
> * subversion/bindings/swig/python/tests/utils.py (file_uri_for_path):
>   Factor out call of pathname2url() into out of conditional block.
>
> Patched by: brane
>
> Modified:
>     subversion/branches/swig-py3/subversion/bindings/swig/python/tests/utils.py
>
> Modified: subversion/branches/swig-py3/subversion/bindings/swig/python/tests/utils.py
> URL: http://svn.apache.org/viewvc/subversion/branches/swig-py3/subversion/bindings/swig/python/tests/utils.py?rev=1867679&r1=1867678&r2=1867679&view=diff
> ==============================================================================
> --- subversion/branches/swig-py3/subversion/bindings/swig/python/tests/utils.py (original)
> +++ subversion/branches/swig-py3/subversion/bindings/swig/python/tests/utils.py Sat Sep 28 15:27:20 2019
> @@ -80,9 +80,8 @@ class Temper(object):
>  def file_uri_for_path(path):
>    """Return the file: URI corresponding to the given path."""
>    if isinstance(path, str):
> -    uri_path = pathname2url(path).encode('UTF-8')
> -  else:
> -    uri_path = pathname2url(path.decode('UTF-8')).encode('UTF-8')
> +    path = path.decode('UTF-8')
> +  uri_path = pathname2url(path).encode('UTF-8')
>
>    # pathname2url claims to return the path part of the URI, but on Windows
>    # it returns both the authority and path parts for no reason, which

That doesn't seem to work correctly. Now I get a lot more errors :-).

[[[
...
ERROR: test_unnamed_editor (repository.SubversionRepositoryTestCase)
Test editor object without reference from interpreter
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\research\svn\dev\swig-py3\subversion\bindings\swig\python\tests\repository.py",
line 89, in setUp
    'trac/versioncontrol/tests/svnrepos.dump', suffix='-repository')
  File "C:\research\svn\dev\swig-py3\subversion\bindings\swig\python\tests\utils.py",
line 74, in alloc_known_repo
    (handle, repo_path, repo_uri) = self.alloc_empty_repo(suffix=suffix)
  File "C:\research\svn\dev\swig-py3\subversion\bindings\swig\python\tests\utils.py",
line 64, in alloc_empty_repo
    repo_uri = core.svn_uri_canonicalize(file_uri_for_path(temp_path))
  File "C:\research\svn\dev\swig-py3\subversion\bindings\swig\python\tests\utils.py",
line 84, in file_uri_for_path
    uri_path = pathname2url(path).encode('UTF-8')
  File "C:\Python37\lib\nturl2path.py", line 53, in pathname2url
    if not ':' in p:
TypeError: a bytes-like object is required, not 'str'

----------------------------------------------------------------------
Ran 153 tests in 2.007s

FAILED (errors=87)
[Test runner reported failure]
]]]


-- 
Johan