pygit2 icon indicating copy to clipboard operation
pygit2 copied to clipboard

test_no_context_lines fails on Big Endian

Open igor-raits opened this issue 7 years ago • 6 comments

======================================================================
FAIL: test_no_context_lines (test.test_patch.PatchTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/pygit2-0.27.1/test/test_patch.py", line 192, in test_no_context_lines
    self.assertEqual(context_count, 0)
AssertionError: 1 != 0
----------------------------------------------------------------------

igor-raits avatar Aug 10 '18 08:08 igor-raits

Added some print in there and get:

tree c36c20831e43e5984c672a714661870b67ab1d95
author Mark Adams <[email protected]> 1517510299 -0600
committer Mark Adams <[email protected]> 1517510441 -0600
Making a GPG signed commit
diff --git a/a/file b/b/file
index a520c24..3b18e51 100644
--- a/a/file
+++ b/b/file
@@ -1,3 +1 @@
 hello world
-hola mundo
-bonjour le monde
+ :
+ /usr/bin/python3 setup.py test --args=-v

igor-raits avatar Aug 10 '18 09:08 igor-raits

There have been major releases of libgit2 (0.99) and pygit2 (1.1); can you try? Such a low level issue is more likely to be from libgit2, so it may be fixed in the latest release.

jdavid avatar Mar 07 '20 11:03 jdavid

So I have tested 1.2.0 + 1.0.0, one test still fails..

=================================== FAILURES ===================================
_______________________ PatchTest.test_no_context_lines ________________________
self = <test.test_patch.PatchTest testMethod=test_no_context_lines>
    def test_no_context_lines(self):
        old_blob = self.repo[BLOB_OLD_SHA]
        new_blob = self.repo[BLOB_NEW_SHA]
    
        patch = pygit2.Patch.create_from(
            old_blob,
            new_blob,
            old_as_path=BLOB_OLD_PATH,
            new_as_path=BLOB_NEW_PATH,
            context_lines=0,
        )
    
        context_count = len(
            [line for line in patch.text.splitlines() if line.startswith(" ")]
        )
    
>       assert context_count == 0
E       AssertionError: assert 1 == 0
E         -1
E         +0
test/test_patch.py:184: AssertionError

igor-raits avatar Apr 15 '20 09:04 igor-raits

The test currently fails on our Alpine Linux s390x builders (which is a big endian platform): py3-pygit2-1.2.1-r0.log

nmeum avatar May 17 '20 18:05 nmeum

For the record I've added s390x to Travis and it's still failing, https://travis-ci.org/github/libgit2/pygit2/jobs/741338976#L1507

jdavid avatar Nov 06 '20 17:11 jdavid

In PR #1130 @roehling has fixed a bug related to big endian. Maybe this is the same kind of issue. If someone wants to check...

jdavid avatar Mar 06 '22 08:03 jdavid