You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm sorry that I've missed this previously but looks like cee5027 introduced two test regressions on big-endian:
$ pytest pytools/test/test_persistent_dict.py::test_{attrs,dataclass}_hashing
========================================================= test session starts =========================================================
platform linux -- Python 3.12.3, pytest-8.3.2, pluggy-1.5.0
rootdir: /home/mgorny/pytoolsconfigfile: pyproject.tomlplugins: xdist-3.6.1
collected 2 items
pytools/test/test_persistent_dict.py FF [100%]
============================================================== FAILURES ===============================================================
_________________________________________________________ test_attrs_hashing __________________________________________________________
deftest_attrs_hashing() -> None:
attrs = pytest.importorskip("attrs")
keyb = KeyBuilder()
@attrs.define
classMyAttrs:
name: str
value: int
> assert (keyb(MyAttrs("hi", 1)) == "5b6c5da60eb2bd0f") # type: ignore[call-arg]
E AssertionError: assert '626f565387d8b006' == '5b6c5da60eb2bd0f'
E
E - 5b6c5da60eb2bd0f
E + 626f565387d8b006
pytools/test/test_persistent_dict.py:593: AssertionError
_______________________________________________________ test_dataclass_hashing ________________________________________________________
deftest_dataclass_hashing() -> None:
keyb = KeyBuilder()
@dataclass
classMyDC:
name: str
value: int
> assert keyb(MyDC("hi", 1)) == "d1a1079f1c10aa4f"
E AssertionError: assert 'e36c7d4306a3670a' == 'd1a1079f1c10aa4f'
E
E - d1a1079f1c10aa4f
E + e36c7d4306a3670a
pytools/test/test_persistent_dict.py:569: AssertionError
======================================================= short test summary info =======================================================
FAILED pytools/test/test_persistent_dict.py::test_attrs_hashing - AssertionError: assert '626f565387d8b006' == '5b6c5da60eb2bd0f'
FAILED pytools/test/test_persistent_dict.py::test_dataclass_hashing - AssertionError: assert 'e36c7d4306a3670a' == 'd1a1079f1c10aa4f'
========================================================== 2 failed in 0.35s ==========================================================
Since we are using the system byte order now, the hashes are different on big-endian and little-endian systems. I suppose this can be fixed either by updating the test to have different expected values depending on sys.byteorder, or by mocking it to force little-endian:
Upon second thought, I think cee5027 was the wrong approach. numpy supports byteswapping, so we should just standardize its representation to a fixed byte order (and revert cee5027) IMO.
I'm sorry that I've missed this previously but looks like cee5027 introduced two test regressions on big-endian:
Since we are using the system byte order now, the hashes are different on big-endian and little-endian systems. I suppose this can be fixed either by updating the test to have different expected values depending on
sys.byteorder
, or by mocking it to force little-endian:Please let me know if I should make a PR doing either of the two.
The text was updated successfully, but these errors were encountered: