On 2019-10-12 02:56, Daniel Shahaf wrote:
Yasuhito FUTATSUKI wrote on Fri, Oct 11, 2019 at 16:35:19 +0900:

The latter also can be fixed by fix_tree_conflict_tests_patch.txt
at least so that the test can be passed on Python 3. However, from above
stack trace, I think it is incomplete because there still exists some sort of
confusion between bytes and str in subversion/tests/cmdline/svntest/*.py

Index: subversion/tests/cmdline/tree_conflict_tests.py
===================================================================
--- subversion/tests/cmdline/tree_conflict_tests.py     (revision 1868264)
+++ subversion/tests/cmdline/tree_conflict_tests.py     (working copy)
@@ -1544,7 +1544,7 @@
    contents = open(sbox.ospath('A1/B/lambda'), 'rb').readlines()
    svntest.verify.compare_and_display_lines(
      "A1/B/lambda has unexpectected contents", sbox.ospath("A1/B/lambda"),
-    [ "This is the file 'lambda'.\n", "This is more content.\n"], contents)
+    [ b"This is the file 'lambda'.\n", b"This is more content.\n"], contents)

Why do you think this is incomplete?  The open() call uses mode='rb', so
«contents» will be set to an array of bytes objects, so it'll need to be
compared to an array of bytes objects.  Which is to say, this patch, too, looks
correct to me.

Yes, it will fix local_missing_dir_endless_loop() itself correctly.
But the stack trace before fix indicate there is at least one problem
in svntest.verify.compare_and_display_lines().

Assume the file contents is broken here. This situation can be simulate
by patch like:

Index: subversion/tests/cmdline/tree_conflict_tests.py
===================================================================
--- subversion/tests/cmdline/tree_conflict_tests.py     (revision 1868264)
+++ subversion/tests/cmdline/tree_conflict_tests.py     (working copy)
@@ -1544,7 +1544,7 @@
   contents = open(sbox.ospath('A1/B/lambda'), 'rb').readlines()
   svntest.verify.compare_and_display_lines(
     "A1/B/lambda has unexpectected contents", sbox.ospath("A1/B/lambda"),
-    [ "This is the file 'lambda'.\n", "This is more content.\n"], contents)
+    [ b"This is the file 'lambda'.\n", b"This is not more content.\n"], 
contents)
#######################################################################


then we will got fails.log, contains stack trace for unexpected exception
within the code to construct log message.

[[[
W: A1/B/lambda has unexpectected contents
W: EXPECTED svn-test-work/working_copies/tree_conflict_tests-26/A1/B/lambda 
(match_all=True):
W: CWD: /home/futatuki/work/subversion/vwc/trunk/subversion/tests/cmdline
Traceback (most recent call last):
  File 
"/home/futatuki/work/subversion/vwc/trunk/subversion/tests/cmdline/svntest/main.py",
 line 1931, in run
    rc = self.pred.run(sandbox)
  File 
"/home/futatuki/work/subversion/vwc/trunk/subversion/tests/cmdline/svntest/testcase.py",
 line 178, in run
    result = self.func(sandbox)
  File 
"/home/futatuki/work/subversion/vwc/trunk/subversion/tests/cmdline/tree_conflict_tests.py",
 line 1547, in local_missing_dir_endless_loop
    [ b"This is the file 'lambda'.\n", b"This is not more content.\n"], 
contents)
  File 
"/home/futatuki/work/subversion/vwc/trunk/subversion/tests/cmdline/svntest/verify.py",
 line 503, in compare_and_display_lines
    expected.display_differences(message, label, actual)
  File 
"/home/futatuki/work/subversion/vwc/trunk/subversion/tests/cmdline/svntest/verify.py",
 line 154, in display_differences
    display_lines(message, self.expected, actual, e_label, label)
  File 
"/home/futatuki/work/subversion/vwc/trunk/subversion/tests/cmdline/svntest/verify.py",
 line 474, in display_lines
    logger.warn('| ' + x.rstrip())
TypeError: can only concatenate str (not "bytes") to str
FAIL:  tree_conflict_tests.py 26: endless loop when resolving local-missing dir
]]]

This is caused by mixing bytes object drived from file contents and str
object to construct log message.

Cheers,
--
Yasuhito FUTATSUKI <futat...@poem.co.jp>

Reply via email to