Tests fail on s390x
I am building pressed v4.0.0 on Alpine Linux and got following tests failing on s390x arch (all other arch run tests fine) [1]:
============================= test session starts ==============================
platform linux -- Python 3.11.3, pytest-7.3.1, pluggy-1.0.0
rootdir: /builds/otlabs/aports/testing/py3-preshed/src/preshed-4.0.0
collected 20 items
preshed/tests/test_bloom.py .....FF. [ 40%]
preshed/tests/test_counter.py .... [ 60%]
preshed/tests/test_hashing.py ....... [ 95%]
preshed/tests/test_pop.py . [100%]
=================================== FAILURES ===================================
_________________________ test_bloom_from_bytes_legacy _________________________
def test_bloom_from_bytes_legacy():
# This is the output from the tests in the legacy format
data = "0200000000000000600000000000000000000000000000003300000000000000e100000000000000b200000000000000da00000000000000e700000000000000e600000000000000ff000000000000004700000000000000e7000000000000004c000000000000003b00000000000000f700000000000000"
data = bytes.fromhex(data)
bf = BloomFilter().from_bytes(data)
for ii in range(0, 1000, 20):
> assert ii in bf
E assert 0 in <preshed.bloom.BloomFilter object at 0x3ff8f39b650>
preshed/tests/test_bloom.py:70: AssertionError
_____________________ test_bloom_from_bytes_legacy_windows _____________________
def test_bloom_from_bytes_legacy_windows():
# This is the output from the tests in the legacy Windows format.
# This is the same as the data in the normal test, but missing the second
# half of each container.
data = "02000000600000000000000033000000e1000000b2000000da000000e7000000e6000000ff00000047000000e70000004c0000003b000000f7000000"
data = bytes.fromhex(data)
bf = BloomFilter().from_bytes(data)
for ii in range(0, 1000, 20):
> assert ii in bf
E assert 0 in <preshed.bloom.BloomFilter object at 0x3ff8f39b730>
preshed/tests/test_bloom.py:87: AssertionError
=========================== short test summary info ============================
FAILED preshed/tests/test_bloom.py::test_bloom_from_bytes_legacy - assert 0 in <preshed.bloom.BloomFilter object at 0x3ff8f39b650>
FAILED preshed/tests/test_bloom.py::test_bloom_from_bytes_legacy_windows - assert 0 in <preshed.bloom.BloomFilter object at 0x3ff8f39b730>
========================= 2 failed, 18 passed in 0.06s =========================
>>> ERROR: py3-preshed: check failed
[1] https://gitlab.alpinelinux.org/otlabs/aports/-/jobs/1021066#L280
Sorry about that! We should have released this as v4.0.0.dev0 for more testing first, since there were other bugs related to spacy, too. I've already yanked it from pypi, but unfortunately an external reviewer was too fast for me and it was already added to conda-forge.
None of our packages like spacy use this version of preshed yet, so there's no current need to build this package and it would probably be better to just skip it if you can.
Thank you for update!
Let me reopen this because it is an open issue for the serialization.
Hi, I used this patch in Debian.
Something smart would be possible, like reversing data when sys.byterorder=big.
--- a/preshed/tests/test_bloom.py
+++ b/preshed/tests/test_bloom.py
@@ -1,6 +1,7 @@
from __future__ import division
import pytest
import pickle
+import sys
from preshed.bloom import BloomFilter
@@ -61,6 +62,7 @@
assert ii in bf2
[email protected](sys.byteorder == 'big', reason="Test is endianess dependant")
def test_bloom_from_bytes_legacy():
# This is the output from the tests in the legacy format
data = "0200000000000000600000000000000000000000000000003300000000000000e100000000000000b200000000000000da00000000000000e700000000000000e600000000000000ff000000000000004700000000000000e7000000000000004c000000000000003b00000000000000f700000000000000"
@@ -75,6 +77,7 @@
assert ii in bf2
[email protected](sys.byteorder == 'big', reason="Test is endianess dependant")
def test_bloom_from_bytes_legacy_windows():
# This is the output from the tests in the legacy Windows format.
# This is the same as the data in the normal test, but missing the second