Skip to content

Test failures on Py3.14 (Fedora 44) #56

@sanjayankur31

Description

@sanjayankur31

Hi there,

I was looking at packaging python-exiv2 for Fedora. While building it from source, I see the following test failures:

+ /usr/bin/pytest -v
============================= test session starts ==============================
platform linux -- Python 3.14.2, pytest-8.4.2, pluggy-1.6.0 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /builddir/build/BUILD/python-exiv2-0.18.0-build/python-exiv2-0.18.0
configfile: pyproject.toml
collecting ... collected 61 items

tests/test_basicio.py::TestBasicIoModule::test_CurlIo SKIPPED (CurlI...) [  1%]
tests/test_basicio.py::TestBasicIoModule::test_FileIo PASSED             [  3%]
tests/test_basicio.py::TestBasicIoModule::test_MemIo PASSED              [  4%]
tests/test_basicio.py::TestBasicIoModule::test_ref_counts PASSED         [  6%]
tests/test_basicio.py::TestBasicIoModule::test_unicode_paths PASSED      [  8%]
tests/test_datasets.py::TestDatasetsModule::test_DataSet PASSED          [  9%]
tests/test_datasets.py::TestDatasetsModule::test_IptcDataSets PASSED     [ 11%]
tests/test_datasets.py::TestDatasetsModule::test_IptcKey PASSED          [ 13%]
tests/test_easyaccess.py::TestEasyaccessModule::test_easyaccess PASSED   [ 14%]
tests/test_error.py::TestErrorModule::test_LogMsg PASSED                 [ 16%]
tests/test_exif.py::TestExifModule::test_ExifData PASSED                 [ 18%]
tests/test_exif.py::TestExifModule::test_ExifData_iterator PASSED        [ 19%]
tests/test_exif.py::TestExifModule::test_ExifDatum PASSED                [ 21%]
tests/test_exif.py::TestExifModule::test_ExifThumb PASSED                [ 22%]
tests/test_exif.py::TestExifModule::test_pointers PASSED                 [ 24%]
tests/test_exif.py::TestExifModule::test_ref_counts FAILED               [ 26%]
tests/test_image.py::TestImageModule::test_BMFF PASSED                   [ 27%]
tests/test_image.py::TestImageModule::test_Image FAILED                  [ 29%]
tests/test_image.py::TestImageModule::test_ImageFactory PASSED           [ 31%]
tests/test_image.py::TestImageModule::test_ref_counts FAILED             [ 32%]
tests/test_iptc.py::TestIptcModule::test_IptcData PASSED                 [ 34%]
tests/test_iptc.py::TestIptcModule::test_IptcData_iterator PASSED        [ 36%]
tests/test_iptc.py::TestIptcModule::test_IptcDatum PASSED                [ 37%]
tests/test_iptc.py::TestIptcModule::test_ref_counts FAILED               [ 39%]
tests/test_metadatum.py::TestMetadatumModule::test_Key PASSED            [ 40%]
tests/test_metadatum.py::TestMetadatumModule::test_Metadatum PASSED      [ 42%]
tests/test_preview.py::TestPreviewModule::test_PreviewImage FAILED       [ 44%]
tests/test_preview.py::TestPreviewModule::test_PreviewManager PASSED     [ 45%]
tests/test_preview.py::TestPreviewModule::test_PreviewProperties PASSED  [ 47%]
tests/test_preview.py::TestPreviewModule::test_ref_counts FAILED         [ 49%]
tests/test_properties.py::TestPropertiesModule::test_XmpKey PASSED       [ 50%]
tests/test_properties.py::TestPropertiesModule::test_XmpNsInfo PASSED    [ 52%]
tests/test_properties.py::TestPropertiesModule::test_XmpProperties PASSED [ 54%]
tests/test_properties.py::TestPropertiesModule::test_XmpPropertyInfo PASSED [ 55%]
tests/test_tags.py::TestTagsModule::test_ExifKey PASSED                  [ 57%]
tests/test_tags.py::TestTagsModule::test_ExifTags PASSED                 [ 59%]
tests/test_tags.py::TestTagsModule::test_GroupInfo PASSED                [ 60%]
tests/test_tags.py::TestTagsModule::test_TagInfo PASSED                  [ 62%]
tests/test_types.py::TestTypesModule::test_DataBuf FAILED                [ 63%]
tests/test_types.py::TestTypesModule::test_Rational PASSED               [ 65%]
tests/test_types.py::TestTypesModule::test_TypeInfo PASSED               [ 67%]
tests/test_types.py::TestTypesModule::test_localisation SKIPPED (fai...) [ 68%]
tests/test_value.py::TestValueModule::test_AsciiValue FAILED             [ 70%]
tests/test_value.py::TestValueModule::test_CommentValue FAILED           [ 72%]
tests/test_value.py::TestValueModule::test_DataValue PASSED              [ 73%]
tests/test_value.py::TestValueModule::test_Date PASSED                   [ 75%]
tests/test_value.py::TestValueModule::test_DateValue PASSED              [ 77%]
tests/test_value.py::TestValueModule::test_LangAltValue PASSED           [ 78%]
tests/test_value.py::TestValueModule::test_StringValue FAILED            [ 80%]
tests/test_value.py::TestValueModule::test_Time PASSED                   [ 81%]
tests/test_value.py::TestValueModule::test_TimeValue PASSED              [ 83%]
tests/test_value.py::TestValueModule::test_URationalValue PASSED         [ 85%]
tests/test_value.py::TestValueModule::test_UShortValue PASSED            [ 86%]
tests/test_value.py::TestValueModule::test_XmpArrayValue PASSED          [ 88%]
tests/test_value.py::TestValueModule::test_XmpTextValue FAILED           [ 90%]
tests/test_version.py::TestVersionModule::test_module PASSED             [ 91%]
tests/test_xmp.py::TestXmpModule::test_XmpData PASSED                    [ 93%]
tests/test_xmp.py::TestXmpModule::test_XmpData_iterator PASSED           [ 95%]
tests/test_xmp.py::TestXmpModule::test_XmpDatum PASSED                   [ 96%]
tests/test_xmp.py::TestXmpModule::test_pointers PASSED                   [ 98%]
tests/test_xmp.py::TestXmpModule::test_ref_counts FAILED                 [100%]

=================================== FAILURES ===================================
________________________ TestExifModule.test_ref_counts ________________________

self = <test_exif.TestExifModule testMethod=test_ref_counts>

    def test_ref_counts(self):
        self.image.readMetadata()
        # exifData keeps a reference to image
        self.assertEqual(sys.getrefcount(self.image), 2)
        data = self.image.exifData()
        self.assertEqual(sys.getrefcount(self.image), 3)
        # thumbnail keeps a reference to exifData
>       self.assertEqual(sys.getrefcount(data), 2)
E       AssertionError: 1 != 2

tests/test_exif.py:320: AssertionError
__________________________ TestImageModule.test_Image __________________________

self = <test_image.TestImageModule testMethod=test_Image>

    def test_Image(self):
        # open image in memory so we don't corrupt the file
        image = exiv2.ImageFactory.open(self.image_data)
        self.assertEqual(len(image.io()), 15125)
        # test clearMetadata
        image.readMetadata()
        self.check_result(image.comment(), str, 'Created with GIMP')
        self.assertEqual(len(image.exifData()), 29)
        self.assertEqual(len(image.iptcData()), 19)
        self.assertEqual(len(image.xmpData()), 26)
        self.assertEqual(len(image.iccProfile()), 672)
        image.clearMetadata()
        self.check_result(image.comment(), str, '')
        self.assertEqual(len(image.exifData()), 0)
        self.assertEqual(len(image.iptcData()), 0)
        self.assertEqual(len(image.xmpData()), 0)
        self.assertEqual(len(image.iccProfile()), 0)
        image.writeMetadata()
        self.assertEqual(len(image.io()), 6371)
        # test setting individual parts
        image2 = exiv2.ImageFactory.open(self.image_data)
        image2.readMetadata()
        image.setComment(image2.comment())
        self.check_result(image.comment(), str, 'Created with GIMP')
        image.setExifData(image2.exifData())
        self.assertEqual(len(image.exifData()), 29)
        image.setIptcData(image2.iptcData())
        self.assertEqual(len(image.iptcData()), 19)
        image.setXmpPacket(image2.xmpPacket())
        self.assertEqual(len(image.xmpPacket()), 4234)
        image.setXmpData(image2.xmpData())
        self.assertEqual(len(image.xmpData()), 26)
        image.setIccProfile(image2.iccProfile())
        self.assertEqual(len(image.iccProfile()), 672)
        image.writeMetadata()
        self.assertEqual(len(image.io()), 15125)
        del image2
        # test clearing individual parts
        image = exiv2.ImageFactory.open(self.image_data)
        image.readMetadata()
        self.check_result(image.comment(), str, 'Created with GIMP')
        image.clearComment()
        self.check_result(image.comment(), str, '')
        self.assertEqual(len(image.exifData()), 29)
        image.clearExifData()
        self.assertEqual(len(image.exifData()), 0)
        self.assertEqual(len(image.iptcData()), 19)
        image.clearIptcData()
        self.assertEqual(len(image.iptcData()), 0)
        self.assertEqual(len(image.xmpPacket()), 4234)
        image.clearXmpPacket()
        self.check_result(image.xmpPacket(), str, '')
        self.assertEqual(len(image.xmpData()), 26)
        image.clearXmpData()
        self.assertEqual(len(image.xmpData()), 0)
        self.assertEqual(len(image.iccProfile()), 672)
        self.check_result(image.iccProfileDefined(), bool, True)
        image.clearIccProfile()
        self.assertEqual(len(image.iccProfile()), 0)
        self.check_result(image.iccProfileDefined(), bool, False)
        # test data access
        image.readMetadata()
>       self.assertEqual(sys.getrefcount(image), 2)
E       AssertionError: 1 != 2

tests/test_image.py:124: AssertionError
_______________________ TestImageModule.test_ref_counts ________________________

self = <test_image.TestImageModule testMethod=test_ref_counts>

    def test_ref_counts(self):
        # opening from data keeps reference to buffer
>       self.assertEqual(sys.getrefcount(self.image_data), 2)
E       AssertionError: 3 != 2

tests/test_image.py:188: AssertionError
________________________ TestIptcModule.test_ref_counts ________________________

self = <test_iptc.TestIptcModule testMethod=test_ref_counts>

    def test_ref_counts(self):
        self.image.readMetadata()
        # iptcData keeps a reference to image
        self.assertEqual(sys.getrefcount(self.image), 2)
        data = self.image.iptcData()
        self.assertEqual(sys.getrefcount(self.image), 3)
        # iterator keeps a reference to data
>       self.assertEqual(sys.getrefcount(data), 2)
E       AssertionError: 1 != 2

tests/test_iptc.py:214: AssertionError
_____________________ TestPreviewModule.test_PreviewImage ______________________

self = <test_preview.TestPreviewModule testMethod=test_PreviewImage>

    def test_PreviewImage(self):
        manager = exiv2.PreviewManager(self.image)
        props = manager.getPreviewProperties()
        preview = manager.getPreviewImage(props[0])
        self.assertIsInstance(preview, exiv2.PreviewImage)
        self.assertEqual(len(preview), preview.size())
        copy = preview.copy()
        self.assertIsInstance(copy, exiv2.DataBuf)
        with self.assertWarns(DeprecationWarning):
            with preview.pData() as data:
                self.check_result(data, memoryview, copy.data())
                self.assertEqual(data[:10], b'\xff\xd8\xff\xe0\x00\x10JFIF')
        with preview.data() as data:
            self.check_result(data, memoryview, copy.data())
            self.assertEqual(data[:10], b'\xff\xd8\xff\xe0\x00\x10JFIF')
>       self.assertEqual(sys.getrefcount(preview), 3)
E       AssertionError: 2 != 3

tests/test_preview.py:57: AssertionError
______________________ TestPreviewModule.test_ref_counts _______________________

self = <test_preview.TestPreviewModule testMethod=test_ref_counts>

    def test_ref_counts(self):
        # manager keeps reference to image
>       self.assertEqual(sys.getrefcount(self.image), 2)
E       AssertionError: 3 != 2

tests/test_preview.py:121: AssertionError
_________________________ TestTypesModule.test_DataBuf _________________________

self = <test_types.TestTypesModule testMethod=test_DataBuf>

    def test_DataBuf(self):
        data = bytes(random.choices(range(256), k=128))
        # constructors
        buf = exiv2.DataBuf()
        self.assertIsInstance(buf, exiv2.DataBuf)
        self.assertEqual(len(buf), 0)
        buf = exiv2.DataBuf(4)
        self.assertEqual(len(buf), 4)
        buf = exiv2.DataBuf(data)
        self.assertEqual(len(buf), len(data))
        self.check_result(buf.data(), memoryview, data)
        # other methods
        self.check_result(buf.size(), int, len(data))
        with buf.data() as view:
            self.assertIsInstance(view, memoryview)
            self.check_result(view[23], int, data[23])
            view[49] = 99
            self.check_result(view[49], int, 99)
        with self.assertRaises(ValueError):
            self.assertEqual(view[0], data[0])
        buf = exiv2.DataBuf(data)
        self.assertEqual(buf, data)
        self.assertEqual(data, buf)
        self.assertNotEqual(buf, b'fred')
        self.assertNotEqual(b'fred', buf)
        if exiv2.testVersion(0, 28, 0):
            self.assertEqual(buf.cmpBytes(0, data), 0)
            self.assertEqual(buf.cmpBytes(5, data[5:]), 0)
            self.assertNotEqual(buf.cmpBytes(0, b'fred'), 0)
            buf.resize(6)
            self.assertEqual(len(buf), 6)
            self.assertEqual(buf.empty(), False)
            buf.resize(0)
            self.assertEqual(buf.empty(), True)
        else:
            with self.assertWarns(DeprecationWarning):
                self.check_result(buf.pData_, memoryview, data)
            with self.assertWarns(DeprecationWarning):
                self.check_result(buf.size_, int, len(data))
            buf.free()
            self.assertEqual(len(buf), 0)
        buf = exiv2.DataBuf(data)
        buf.reset()
        self.assertEqual(len(buf), 0)
        buf = exiv2.DataBuf()
        buf.alloc(6)
        self.assertEqual(len(buf), 6)
        # memoryview invalidation
        view = buf.data()
        buf.alloc(8)
        with self.assertRaises(ValueError):
            view[0]
        view = buf.data()
>       self.assertEqual(sys.getrefcount(buf), 3)
E       AssertionError: 2 != 3

tests/test_types.py:87: AssertionError
_______________________ TestValueModule.test_AsciiValue ________________________

self = <test_value.TestValueModule testMethod=test_AsciiValue>

    def test_AsciiValue(self):
        text = 'The quick brown fox jumps over the lazy dog. àéīöûç'
        data = bytes(text, 'utf-8') + b'\x00'
        # constructors
        value = exiv2.AsciiValue()
        self.assertIsInstance(value, exiv2.AsciiValue)
        self.assertEqual(len(value), 0)
        value = exiv2.AsciiValue(text)
        self.assertIsInstance(value, exiv2.AsciiValue)
        # other methods
        self.do_common_tests(value, exiv2.TypeId.asciiString, text, data)
>       self.do_common_string_tests(value, data)

tests/test_value.py:172:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_value.py:134: in do_common_string_tests
    self.assertEqual(sys.getrefcount(copy), 3)
E   AssertionError: 2 != 3
______________________ TestValueModule.test_CommentValue _______________________

self = <test_value.TestValueModule testMethod=test_CommentValue>

    def test_CommentValue(self):
        raw_text = 'The quick brown fox jumps over the lazy dog. àéīöûç'
        data = b'UNICODE\x00' + bytes(raw_text, 'utf-16-le')
        if exiv2.testVersion(0, 27, 3):
            text = 'charset=Unicode ' + raw_text
        else:
            text = 'charset="Unicode" ' + raw_text
        # constructors
        value = exiv2.CommentValue()
        self.assertIsInstance(value, exiv2.CommentValue)
        self.assertEqual(len(value), 0)
        value = exiv2.CommentValue(text)
        self.assertIsInstance(value, exiv2.CommentValue)
        # other methods
        with self.assertWarns(DeprecationWarning):
            result = exiv2.CharsetId.ascii
        self.check_result(value.charsetId(), exiv2.CommentValue.CharsetId,
                          exiv2.CommentValue.CharsetId.unicode)
        self.check_result(value.comment(), str, raw_text)
        self.check_result(value.detectCharset(raw_text), str, 'UCS-2LE')
        self.check_result(
            value.byteOrder_, exiv2.ByteOrder, exiv2.ByteOrder.littleEndian)
        self.do_common_tests(value, exiv2.TypeId.comment, text, data)
>       self.do_common_string_tests(value, data)

tests/test_value.py:199:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_value.py:134: in do_common_string_tests
    self.assertEqual(sys.getrefcount(copy), 3)
E   AssertionError: 2 != 3
_______________________ TestValueModule.test_StringValue _______________________

self = <test_value.TestValueModule testMethod=test_StringValue>

    def test_StringValue(self):
        text = 'The quick brown fox jumps over the lazy dog. àéīöûç'
        data = bytes(text, 'utf-8')
        # constructors
        value = exiv2.StringValue()
        self.assertIsInstance(value, exiv2.StringValue)
        self.assertEqual(len(value), 0)
        value = exiv2.StringValue(text)
        self.assertIsInstance(value, exiv2.StringValue)
        # other methods
        self.do_common_tests(value, exiv2.TypeId.string, text, data)
>       self.do_common_string_tests(value, data)

tests/test_value.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_value.py:134: in do_common_string_tests
    self.assertEqual(sys.getrefcount(copy), 3)
E   AssertionError: 2 != 3
______________________ TestValueModule.test_XmpTextValue _______________________

self = <test_value.TestValueModule testMethod=test_XmpTextValue>

    def test_XmpTextValue(self):
        text = 'The quick brown fox jumps over the lazy dog. àéīöûç'
        data = bytes(text, 'utf-8')
        # constructors
        value = exiv2.XmpTextValue()
        self.assertIsInstance(value, exiv2.XmpTextValue)
        self.assertEqual(len(value), 0)
        value = exiv2.XmpTextValue(text)
        self.assertIsInstance(value, exiv2.XmpTextValue)
        # other methods
        self.do_common_tests(value, exiv2.TypeId.xmpText, text, data)
>       self.do_common_string_tests(value, data)

tests/test_value.py:315:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_value.py:134: in do_common_string_tests
    self.assertEqual(sys.getrefcount(copy), 3)
E   AssertionError: 2 != 3
________________________ TestXmpModule.test_ref_counts _________________________

self = <test_xmp.TestXmpModule testMethod=test_ref_counts>

    def test_ref_counts(self):
        self.image.readMetadata()
        # xmpData keeps a reference to image
        self.assertEqual(sys.getrefcount(self.image), 2)
        data = self.image.xmpData()
        self.assertEqual(sys.getrefcount(self.image), 3)
        # iterator keeps a reference to data
>       self.assertEqual(sys.getrefcount(data), 2)
E       AssertionError: 1 != 2

tests/test_xmp.py:256: AssertionError
=========================== short test summary info ============================
FAILED tests/test_exif.py::TestExifModule::test_ref_counts - AssertionError: ...
FAILED tests/test_image.py::TestImageModule::test_Image - AssertionError: 1 != 2
FAILED tests/test_image.py::TestImageModule::test_ref_counts - AssertionError...
FAILED tests/test_iptc.py::TestIptcModule::test_ref_counts - AssertionError: ...
FAILED tests/test_preview.py::TestPreviewModule::test_PreviewImage - Assertio...
FAILED tests/test_preview.py::TestPreviewModule::test_ref_counts - AssertionE...
FAILED tests/test_types.py::TestTypesModule::test_DataBuf - AssertionError: 2...
FAILED tests/test_value.py::TestValueModule::test_AsciiValue - AssertionError...
FAILED tests/test_value.py::TestValueModule::test_CommentValue - AssertionErr...
FAILED tests/test_value.py::TestValueModule::test_StringValue - AssertionErro...
FAILED tests/test_value.py::TestValueModule::test_XmpTextValue - AssertionErr...
FAILED tests/test_xmp.py::TestXmpModule::test_ref_counts - AssertionError: 1 ...
=================== 12 failed, 47 passed, 2 skipped in 0.31s ===================


The complete build log is attached:

python-exiv2-build-log.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions