-
Notifications
You must be signed in to change notification settings - Fork 406
Closed
Description
Hi!
Summary
Two unit tests started to fail with the update to PyAV 16.0.0 and/or ffmpeg 8.0:
Detailed error description
_______________________ TestDecode.test_hardware_decode ________________________
self = <tests.test_decode.TestDecode testMethod=test_hardware_decode>
def test_hardware_decode(self) -> None:
> hwdevices_available = av.codec.hwaccel.hwdevices_available()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tests/test_decode.py:213:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
av/codec/hwaccel.pyx:84: in av.codec.hwaccel.hwdevices_available
???
av/codec/hwaccel.pyx:92: in av.codec.hwaccel.hwdevices_available
???
/usr/lib/python3.13/enum.py:726: in __call__
return cls.__new__(cls, value)
^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <enum 'HWDeviceType'>, value = 13
def __new__(cls, value):
# all enum instances are actually created during class construction
# without calling this method; this method is called by the metaclass'
# __call__ (i.e. Color(3) ), and by pickle
if type(value) is cls:
# For lookups like Color(Color.RED)
return value
# by-value search for a matching enum member
# see if it's in the reverse mapping (for hashable values)
try:
return cls._value2member_map_[value]
except KeyError:
# Not found, no need to do long O(n) search
pass
except TypeError:
# not there, now do long search -- O(n) behavior
for name, unhashable_values in cls._unhashable_values_map_.items():
if value in unhashable_values:
return cls[name]
for name, member in cls._member_map_.items():
if value == member._value_:
return cls[name]
# still not found -- verify that members exist, in-case somebody got here mistakenly
# (such as via super when trying to override __new__)
if not cls._member_map_:
if getattr(cls, '_%s__in_progress' % cls.__name__, False):
raise TypeError('do not use `super().__new__; call the appropriate __new__ directly') from None
raise TypeError("%r has no members defined" % cls)
#
# still not found -- try _missing_ hook
try:
exc = None
result = cls._missing_(value)
except Exception as e:
exc = e
result = None
try:
if isinstance(result, cls):
return result
elif (
Flag is not None and issubclass(cls, Flag)
and cls._boundary_ is EJECT and isinstance(result, int)
):
return result
else:
ve_exc = ValueError("%r is not a valid %s" % (value, cls.__qualname__))
if result is None and exc is None:
> raise ve_exc
E ValueError: 13 is not a valid HWDeviceType
/usr/lib/python3.13/enum.py:1203: ValueError
______________________ TestPacketSideData.test_data_types ______________________
self = <tests.test_packet.TestPacketSideData object at 0x7fe6accf7c50>
def test_data_types(self) -> None:
dtypes = get_args(av.packet.PktSideDataT)
> ffmpeg_ver = [int(v) for v in av.ffmpeg_version_info.split(".", 2)[:2]]
^^^^^^
E ValueError: invalid literal for int() with base 10: 'n8'
tests/test_packet.py:58: ValueError
The latter one seems to be related to ffmpeg’s idea of version strings that do not necessarily follow semver guidelines, but can start with a letter. This should be easy to be fixed right there inside the test function.
The first one, then, seems to relate to an erroneous enumeration of hardware devices. I’m not quite sure how to continue investigating it, please advice
Context
I’m the maintainer of the AUR build script for PyAV. That means, I build PyAV in an isolated chroot, against the system-supplied ffmpeg (currently v8.0), then run the pytest unit tests against the built binaries, on Arch Linux, Linux 6.15.3, glibc 2.42, Python 3.13.7.
Metadata
Metadata
Assignees
Labels
No labels