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

Re: swig-py3 svn_stream_read

From: Troy Curtis Jr <troycurtisjr_at_gmail.com>
Date: Fri, 23 Mar 2018 11:09:42 +0000

On Fri, Mar 23, 2018, 3:10 AM Daniel Shahaf <d.s_at_daniel.shahaf.name> wrote:

> Trying to merge trunk_at_HEAD into branches/swig-py3, the py2 tests pass
> but the py3 tests fail:
>
> [[[
> ............................................E/usr/lib/python3.5/unittest/case.py:629:
> ResourceWarning: unclosed file <_io.BufferedWriter name='/tmp/tmpt0y_m2lx'>
> outcome.errors.clear()
> E/usr/lib/python3.5/unittest/case.py:629: ResourceWarning: unclosed file
> <_io.BufferedWriter name='/tmp/tmpnxp8y69m'>
> outcome.errors.clear()
>
> ...................................................................................
> ======================================================================
> ERROR: test_diff_repos_paths_external (fs.SubversionFSTestCase)
> Test diffing of a repository path using an external diff (if available).
> ----------------------------------------------------------------------
> ⋮
> ======================================================================
> ERROR: test_diff_repos_paths_internal (fs.SubversionFSTestCase)
> Test diffing of a repository path using the internal diff.
> ----------------------------------------------------------------------
> Traceback (most recent call last):
> File
> "/home/daniel/in/svn/swig-py3/subversion/bindings/swig/python/tests/fs.py",
> line 93, in test_diff_repos_paths_internal
> diffp = fdiff.get_pipe()
> File
> "/home/daniel/in/svn/swig-py3/subversion/bindings/swig/python/tests/../svn/fs.py",
> line 113, in get_pipe
> self.get_files()
> File
> "/home/daniel/in/svn/swig-py3/subversion/bindings/swig/python/tests/../svn/fs.py",
> line 107, in get_files
> self._dump_contents(self.tempfile1, self.root1, self.path1)
> File
> "/home/daniel/in/svn/swig-py3/subversion/bindings/swig/python/tests/../svn/fs.py",
> line 92, in _dump_contents
> fp.write(chunk)
> TypeError: a bytes-like object is required, not 'str'
>
> ----------------------------------------------------------------------
> Ran 129 tests in 2.203s
> ]]]
>
> The relevant revisions being merged are:
>
> % svn mergeinfo --show-revs eligible
> {../trunk,../swig-py3}/subversion/bindings/swig/ | me
> r1823802 - Ensure Python bindings for fs.FileDiff behaves correctly when
> the python-future package is installed.
> r1824410 - Fix Python unit test, fs.SubversionFSTestCase, on Windows.
> r1825316 - Update external 'diff' command test for svn.fs.FileDiff() to
> depend on presence of the command instead of testing for 'win32' platform.
> %
>
> (OT: it'd be nice to have an 'svn log' mode that shows just the first
> line/paragraph of each listed revision, as above)
>

+1 to this idea. I certainly use it all the time when I'm working with git
repos.

The first two revisions changed open() call modes to use binary mode,
> which is likely the cause of the bytes/str mismatch. However, looking
> into it —
>
> >>> sys.version_info.major
> 3
> >>> from svn.core import *
> >>> e = svn_stream_empty()
> >>> svn_stream_read(e, 5)
> ''
> >>>
>
> — shouldn't svn_stream_read() return bytes under py3?
>

Yes, I would say that bytes is absolutely the right thing to return here
since svn_stream is an arbitrary byte interface.

I seem to remember thinking the tests weren't going to work on the swig-py3
branch out-of-the-box, but I would be lying if I said I could remember the
details of what I was thinking!

Troy

>
> Cheers,
>
> Daniel
>
Received on 2018-03-23 12:10:08 CET

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.