From af8bfe3ce7bcfd8fdae4de34cde903cc22909f71 Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Mon, 13 Jan 2025 15:35:03 +0200 Subject: [PATCH] Make test_export_with_non_default_frame_step compatible with Python 3.11+ (#8927) In Python 3.11, `Enum.__format__` was changed to be the same as `Enum.__str__`, so the yielded format name ends up being `CVAT for _SourceDataType.images 1.1`. Use the string value explicitly. Also, remove the `str` base class from `_SourceDataType`, since it appears to be actively misleading (as well as unnecessary). --- tests/python/rest_api/test_tasks.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/python/rest_api/test_tasks.py b/tests/python/rest_api/test_tasks.py index a55bd1ded65b..e226935d82d0 100644 --- a/tests/python/rest_api/test_tasks.py +++ b/tests/python/rest_api/test_tasks.py @@ -2681,7 +2681,7 @@ def test_can_create_task_with_validation_and_cloud_data( assert (img.shape[0], img.shape[1]) == (img_meta.height, img_meta.width) -class _SourceDataType(str, Enum): +class _SourceDataType(Enum): images = "images" video = "video" @@ -6490,7 +6490,7 @@ def fxt_uploaded_media_task( with make_sdk_client(self._USERNAME) as client: task = client.tasks.retrieve(task_id) - yield (spec, task, f"CVAT for {media_type} 1.1") + yield (spec, task, f"CVAT for {media_type.value} 1.1") @pytest.mark.usefixtures("restore_redis_ondisk_per_function") @parametrize("spec, task, format_name", [fixture_ref(fxt_uploaded_media_task)])