ccpem/mrcfile

8 test failures on s390x

rathann opened this issue · 4 comments

mrcfile version 1.3.0 test suite is showing 8 test failures when executed on Fedora rawhide s390x arch:

$ python3 -m unittest tests
..............................FF.............................................................................................................................FF..........................................................................................................................................................................................................................................................................FF.................................................................................................................FF...................................................................................../builddir/build/BUILD/mrcfile-1.3.0/tests/test_utils.py:139: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  utils.mode_from_dtype(np.dtype(np.bool))
...................................................................................
======================================================================
FAIL: test_extended_header_from_FEI1_file (tests.test_bzip2mrcfile.Bzip2MrcFileTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/mrcfile-1.3.0/tests/test_mrcfile.py", line 177, in test_extended_header_from_FEI1_file
    assert ext[0]['Metadata size'] == 768
AssertionError
======================================================================
FAIL: test_extended_header_from_FEI2_file (tests.test_bzip2mrcfile.Bzip2MrcFileTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/mrcfile-1.3.0/tests/test_mrcfile.py", line 193, in test_extended_header_from_FEI2_file
    assert ext[0]['Metadata size'] == 888
AssertionError
======================================================================
FAIL: test_extended_header_from_FEI1_file (tests.test_gzipmrcfile.GzipMrcFileTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/mrcfile-1.3.0/tests/test_mrcfile.py", line 177, in test_extended_header_from_FEI1_file
    assert ext[0]['Metadata size'] == 768
AssertionError
======================================================================
FAIL: test_extended_header_from_FEI2_file (tests.test_gzipmrcfile.GzipMrcFileTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/mrcfile-1.3.0/tests/test_mrcfile.py", line 193, in test_extended_header_from_FEI2_file
    assert ext[0]['Metadata size'] == 888
AssertionError
======================================================================
FAIL: test_extended_header_from_FEI1_file (tests.test_mrcfile.MrcFileTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/mrcfile-1.3.0/tests/test_mrcfile.py", line 177, in test_extended_header_from_FEI1_file
    assert ext[0]['Metadata size'] == 768
AssertionError
======================================================================
FAIL: test_extended_header_from_FEI2_file (tests.test_mrcfile.MrcFileTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/mrcfile-1.3.0/tests/test_mrcfile.py", line 193, in test_extended_header_from_FEI2_file
    assert ext[0]['Metadata size'] == 888
AssertionError
======================================================================
FAIL: test_extended_header_from_FEI1_file (tests.test_mrcmemmap.MrcMemmapTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/mrcfile-1.3.0/tests/test_mrcfile.py", line 177, in test_extended_header_from_FEI1_file
    assert ext[0]['Metadata size'] == 768
AssertionError
======================================================================
FAIL: test_extended_header_from_FEI2_file (tests.test_mrcmemmap.MrcMemmapTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/mrcfile-1.3.0/tests/test_mrcfile.py", line 193, in test_extended_header_from_FEI2_file
    assert ext[0]['Metadata size'] == 888
AssertionError
----------------------------------------------------------------------
Ran 710 tests in 11.009s
FAILED (failures=8)

@mtasaka do you think you could lend a hand here?

Thanks for reporting. This problem was actually anticipated (see comment here) but I was never able to test mrcfile on genuine big-endian hardware so it's very useful to see the results!

I'll change the code so it uses the same endianness for the FEI extended header as it does for the rest of the file. In the meantime, if you're not intending to use the FEI extended headers in your code, you can safely ignore these test failures. The fact all the rest of the tests passed means mrcfile is generally behaving properly on your system and there aren't any other endianness problems. Apart from these failing tests, nothing in mrcfile actually uses this "Metadata size" field.

You're welcome! Fedora is built on s390x, so we're testing everything on big-endian regularly. I'd be happy to test any patches.

Thanks for the offer, but there's no need for you to test this again. Since the last time I last did any serious work on mrcfile, the Travis CI system has added the option to run builds on s390x systems. I was able to use that reproduce these test failures and then confirm that the tests all pass now the fix is in place.

So, the latest GitHub version of mrcfile is now fine for use on big-endian architectures, and these changes will be included in the next PyPI release which is likely to be in the next few weeks.