hMatoba / Piexif

Exif manipulation with pure python script.
MIT License
367 stars 81 forks source link

Test suite failing with Pillow 7.2.0 #108

Open cript0nauta opened 3 years ago

cript0nauta commented 3 years ago

If I run piexif tests with Pillow 7.2.0, they fail:

======================================================================
ERROR: test_load (s_test.ExifTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./tests/s_test.py", line 110, in test_load
    self._compare_piexifDict_PILDict(exif, e, p=False)
  File "./tests/s_test.py", line 614, in _compare_piexifDict_PILDict
    self._compare_value(zeroth_ifd[key], pilDict[key])
  File "./tests/s_test.py", line 585, in _compare_value
    self.assertEqual(pack_byte(*v1), v2)
  File "./tests/s_test.py", line 87, in pack_byte
    return struct.pack("B" * len(args), *args)
struct.error: ubyte format requires 0 <= number <= 255

======================================================================
ERROR: test_load_m (s_test.ExifTests)
'load' on memory.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./tests/s_test.py", line 118, in test_load_m
    self._compare_piexifDict_PILDict(exif, e)
  File "./tests/s_test.py", line 614, in _compare_piexifDict_PILDict
    self._compare_value(zeroth_ifd[key], pilDict[key])
  File "./tests/s_test.py", line 585, in _compare_value
    self.assertEqual(pack_byte(*v1), v2)
  File "./tests/s_test.py", line 87, in pack_byte
    return struct.pack("B" * len(args), *args)
struct.error: ubyte format requires 0 <= number <= 255

======================================================================
ERROR: test_load_unicode_filename (s_test.ExifTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./tests/s_test.py", line 186, in test_load_unicode_filename
    self._compare_piexifDict_PILDict(exif, e, p=False)
  File "./tests/s_test.py", line 614, in _compare_piexifDict_PILDict
    self._compare_value(zeroth_ifd[key], pilDict[key])
  File "./tests/s_test.py", line 585, in _compare_value
    self.assertEqual(pack_byte(*v1), v2)
  File "./tests/s_test.py", line 87, in pack_byte
    return struct.pack("B" * len(args), *args)
struct.error: ubyte format requires 0 <= number <= 255

----------------------------------------------------------------------

With Pillow 7.1.2, it works ok. I did some bisecting and noted that this Pillow commit is responsible for breaking piexif tests: https://github.com/python-pillow/Pillow/commit/ccac9e1a3a08886827af0dc443396af760c5cbe6.

I'm not sure whether this is a bug on Pillow, in piexif or in the tests.

I noted this bug because piexif fails to build with the Nix package manager because their tests fail.