Skip to content

Commit

Permalink
trying to fix test which fails on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Eldies committed Feb 7, 2025
1 parent 240196f commit cb16095
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions tests/unit/test_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@
from tests.utils.video import make_sample_video


def _make_sample_video(video_dir, fname="video.avi", frame_size=(4, 6), frames=4):
video_path = osp.join(video_dir, fname)
make_sample_video(video_path, frame_size=frame_size, frames=frames)
return video_path


@pytest.fixture(scope="module")
def fxt_sample_video():
with TestDir() as test_dir:
video_path = osp.join(test_dir, "video.avi")
make_sample_video(video_path, frame_size=(4, 6), frames=4)

yield video_path
yield _make_sample_video(test_dir)


class VideoTest:
Expand Down Expand Up @@ -198,12 +201,13 @@ def test_can_release_resources_on_remove(self, fxt_sample_video):

@mark_requirement(Requirements.DATUM_GENERAL_REQ)
@scoped
def test_can_release_resources_on_checkout(self, fxt_sample_video):
test_dir = scope_add(TestDir())
def test_can_release_resources_on_checkout(self, test_dir):
video_path = _make_sample_video(test_dir)
project_dir = scope_add(TestDir())

project = scope_add(Project.init(test_dir))
project = scope_add(Project.init(project_dir))

src_url = osp.join(test_dir, "src")
src_url = osp.join(project_dir, "src")
src = Dataset.from_iterable(
[
DatasetItem(1),
Expand All @@ -218,14 +222,14 @@ def test_can_release_resources_on_checkout(self, fxt_sample_video):

project.import_source(
"src",
osp.dirname(fxt_sample_video),
osp.dirname(video_path),
"video_frames",
rpath=osp.basename(fxt_sample_video),
rpath=osp.basename(video_path),
)
project.commit("commit 2")

assert len(project.working_tree.make_dataset()) == 4
assert osp.isdir(osp.join(test_dir, "src"))
assert osp.isdir(osp.join(project_dir, "src"))

project.checkout("HEAD~1")

Expand Down

0 comments on commit cb16095

Please sign in to comment.