Thank you for testing.

On 2019/09/24 5:48, Johan Corveleyn wrote:
So, on to the next problem. When testing with Python 3.7.4 on Windows,
I get the following error:

[[[
C:\research\svn\dev\swig-py3>python win-tests.py -c --log-level=DEBUG
--release --swig=python R:\test_py
'ruby' is not recognized as an internal or external command,
operable program or batch file.
Testing Release configuration on local repository.
-- Running Swig Python tests --
Traceback (most recent call last):
   File 
"C:\research\svn\dev\swig-py3\subversion\bindings\swig\python\tests\run_all.py",
line 23, in <module>
     import mergeinfo, core, client, delta, checksum, pool, fs, ra, wc,
repository, \
   File 
"C:\research\svn\dev\swig-py3\subversion\bindings\swig\python\tests\trac\versioncontrol\tests\__init__.py",
line 23, in <module>
     from trac.versioncontrol.tests import svn_fs
   File 
"C:\research\svn\dev\swig-py3\subversion\bindings\swig\python\tests\trac\versioncontrol\tests\svn_fs.py",
line 73, in <module>
     REPOS_URL = pathname2url(temp_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'
[Test runner reported failure]
]]]

It seems that urllib.request.pathname2url() on Windows doesn't accept
bytes on Python 3, while on Linux/Unix it accepts both of bytes and str.

The patch attached may fix it.
(The warning about 'ruby' is not a big deal I suppose, but it's also
something I saw when running gen-make.py with python 3.7 -- not when
I'm running it with python 2.7)
I think that message comes from build/generator/gen_win_dependencies.py,
GenDependenciesBase._find_ruby() line 967 (message from shell program
on Windows).

https://svn.apache.org/viewvc/subversion/branches/swig-py3/build/generator/gen_win_dependencies.py?revision=1862754&view=markup#l967

This may be also caused with Python 2, if 'ruby' is not in command
search path.

Cheers,
--
Yasuhito FUTATSUKI <futat...@poem.co.jp>
On branch swig-py3: fix test for swig-py on Python 3 on Windows

[ in subversion/bindings/swig/python/tests/]
 * trac/versioncontrol/tests/svn_fs.py (REPOS_PATH, REPOS_URL),
   On Python 3, pass a str object as argument to urllib.request.pathname2url()
   instead of a bytes.
 * util.py (file_uri_for_path):
   On Python 3, pass a str object as argument to urllib.request.pathname2url()
   instead of a bytes even if the argment `path' is a bytes object.

Reported by: jcorvel 
Index: subversion/bindings/swig/python/tests/trac/versioncontrol/tests/svn_fs.py
===================================================================
--- subversion/bindings/swig/python/tests/trac/versioncontrol/tests/svn_fs.py   
(revision 1867212)
+++ subversion/bindings/swig/python/tests/trac/versioncontrol/tests/svn_fs.py   
(working copy)
@@ -68,8 +68,8 @@
 from trac.versioncontrol import Changeset, Node
 from trac.versioncontrol.svn_fs import SubversionRepository
 
-temp_path = tempfile.mktemp("-trac-svnrepos").encode('UTF-8')
-REPOS_PATH = core.svn_dirent_internal_style(temp_path)
+temp_path = tempfile.mktemp("-trac-svnrepos")
+REPOS_PATH = core.svn_dirent_internal_style(temp_path.encode('UTF-8'))
 REPOS_URL = pathname2url(temp_path).encode('UTF-8')
 del temp_path
 
Index: subversion/bindings/swig/python/tests/utils.py
===================================================================
--- subversion/bindings/swig/python/tests/utils.py      (revision 1867212)
+++ subversion/bindings/swig/python/tests/utils.py      (working copy)
@@ -79,7 +79,10 @@
 
 def file_uri_for_path(path):
   """Return the file: URI corresponding to the given path."""
-  uri_path = pathname2url(path).encode('UTF-8')
+  if isinstance(path, str):
+    uri_path = pathname2url(path).encode('UTF-8')
+  else:
+    uri_path = pathname2url(path.decode('UTF-8')).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

Reply via email to