Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug fix] restore test for splitting video #1188

Merged
merged 2 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/datumaro/components/media.py
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,7 @@ def from_bytes(cls, *args, **kwargs):
raise DatumaroError(f"Please use a factory function '{cls.__name__}.from_image_roi_pairs'.")


class MosiacImageFromData(FromDataMixin, MosaicImage):
class MosaicImageFromData(FromDataMixin, MosaicImage):
def save(
self,
fp: Union[str, io.IOBase],
Expand All @@ -1104,7 +1104,7 @@ def save(
save_image(fp, data, ext=new_ext, crypter=crypter)


class MosaicImageFromImageRoIPairs(MosiacImageFromData):
class MosaicImageFromImageRoIPairs(MosaicImageFromData):
def __init__(self, data: List[ImageWithRoI], size: Tuple[int, int]) -> None:
def _get_mosaic_img() -> np.ndarray:
h, w = self.size
Expand Down
7 changes: 5 additions & 2 deletions tests/integration/cli/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import os
import os.path as osp
from unittest.case import TestCase
from unittest.mock import PropertyMock, patch

import numpy as np
import pytest

from datumaro.components.media_manager import MediaManager
Expand All @@ -14,11 +16,12 @@
from tests.utils.test_utils import run_datum as run


@pytest.mark.xfail(reason="This test is flaky so that can fail randomly")
class VideoSplittingTest:
@mark_requirement(Requirements.DATUM_GENERAL_REQ)
@scoped
def test_can_split_video(self):
@patch("datumaro.components.media.VideoFrame.data", new_callable=PropertyMock)
def test_can_split_video(self, mock_video_frame_data):
mock_video_frame_data.return_value = np.full((32, 32, 3), fill_value=0, dtype=np.uint8)
on_exit_do(MediaManager.get_instance().clear)

test_dir = scope_add(TestDir())
Expand Down
Loading