From 575f9c6244fd85fdc4b80d9d5b8376fe76728899 Mon Sep 17 00:00:00 2001 From: Ondrej Samohel Date: Fri, 14 Feb 2025 13:32:40 +0100 Subject: [PATCH] :sparkles: add tests for Bundle --- pyproject.toml | 4 +- .../plugins/publish/test_integrate_traits.py | 45 ++++++++++++++++++- 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 65132efcae..3e668ca3e8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,8 +17,8 @@ pre-commit = "^4.0.0" clique = "^2" pyblish-base = "^1.8" attrs = "^24.2.0" -mypy = "==1.15.0" pydantic-core = "==2.29.0" +speedcopy = "^2.0.0" [tool.poetry.dev-dependencies] @@ -31,7 +31,7 @@ ruff = "^0.9.3" pre-commit = "^4" codespell = "^2.2.6" semver = "^3.0.2" -mypy = "^1.14.0" +mypy = "==1.15.0" [tool.ruff] diff --git a/tests/client/ayon_core/plugins/publish/test_integrate_traits.py b/tests/client/ayon_core/plugins/publish/test_integrate_traits.py index 450cfb5f9f..252556fe29 100644 --- a/tests/client/ayon_core/plugins/publish/test_integrate_traits.py +++ b/tests/client/ayon_core/plugins/publish/test_integrate_traits.py @@ -14,6 +14,7 @@ from ayon_api.operations import ( ) from ayon_core.pipeline.anatomy import Anatomy from ayon_core.pipeline.traits import ( + Bundle, FileLocation, FileLocations, FrameRanged, @@ -177,6 +178,44 @@ def mock_context( pixel_aspect_ratio=1.0), MimeType(mime_type="image/png"), ]), + Representation(name="test_bundle", traits=[ + Persistent(), + Bundle( + items=[ + [ + FileLocation( + file_path=single_file, + file_size=len(base64.b64decode(PNG_FILE_B64))), + Image(), + MimeType(mime_type="image/png"), + ], + [ + Persistent(), + FrameRanged( + frame_start=1, + frame_end=SEQUENCE_LENGTH, + frame_in=0, + frame_out=SEQUENCE_LENGTH - 1, + frames_per_second="25", + ), + Sequence( + frame_padding=4, + frame_regex=re.compile( + r"img\.(?P(?P0*)\d{4})\.png$"), + ), + FileLocations( + file_paths=file_locations, + ), + Image(), + PixelBased( + display_window_width=1920, + display_window_height=1080, + pixel_aspect_ratio=1.0), + MimeType(mime_type="image/png"), + ], + ], + ), + ]), ] return context @@ -289,4 +328,8 @@ def test_get_transfers_from_representation( transfers = integrator.get_transfers_from_representations( instance, representations) - assert len(transfers) == 11 + assert len(representations) == 3 + assert len(transfers) == 22 + + for transfer in transfers: + ...