sissaschool/elementpath

test_datatypes.(Duration|Timezone)TypesTest.test_hashing fails on 32bit arches

hroncok opened this issue · 6 comments

I ma packaging elementpath for Fedora. As a arch independent package, it gets a random (Fedora supported) architecture during build. On armv7hl I have a test failure, probably due to overflow:

FAIL: test_hashing (tests.test_datatypes.DurationTypesTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/elementpath-1.3.2/tests/test_datatypes.py", line 603, in test_hashing
    self.assertEqual(hash(Duration(16)), 6141449309508620102)
AssertionError: -1561201661 != 6141449309508620102
======================================================================
FAIL: test_hashing (tests.test_datatypes.TimezoneTypeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/elementpath-1.3.2/tests/test_datatypes.py", line 653, in test_hashing
    self.assertEqual(hash(Timezone.fromstring('+05:00')), 7009945331308913293)
AssertionError: 1370907298 != 7009945331308913293

That is with elementpath 1.3.2.

I've reproduced this on i686 as well:

======================================================================
FAIL: test_hashing (tests.test_datatypes.DurationTypesTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/elementpath-1.3.2/tests/test_datatypes.py", line 603, in test_hashing
    self.assertEqual(hash(Duration(16)), 6141449309508620102)
AssertionError: -1561201661 != 6141449309508620102
======================================================================
FAIL: test_hashing (tests.test_datatypes.TimezoneTypeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/elementpath-1.3.2/tests/test_datatypes.py", line 653, in test_hashing
    self.assertEqual(hash(Timezone.fromstring('+05:00')), 7009945331308913293)
AssertionError: 1370907298 != 7009945331308913293

Hi,
seems to be different hashing algoritms instead of overflows. Anyway it's better if I reduce hashing tests only to int-type checks.

The packaging is for Python 3 only or you still require Python 2? In the first case I will put a patch for this issue in v1.4.0, otherwise I'll make a v1.3.4 release.

Python 3 only, fortunately. Thanks.

Ok,
I'll work for a patch for v1.4.0 asap (only to clean Python 2 code and eventually add some tests to increase coverage).
Thanks

The patch is available with release v1.4.0. Close the issue if tests are ok now.
Thanks

Thanks.