From dd31284508442fb6fa00c23f7530d4daa87f3bcf Mon Sep 17 00:00:00 2001 From: Johan Walles Date: Wed, 12 Jun 2024 09:29:28 +0200 Subject: [PATCH] Add a dummy test case --- tests/__init__.py | 0 tests/test_find_bad_tracks.py | 21 +++++++++++++++++++++ tox.ini | 11 ++++++++++- 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 tests/__init__.py create mode 100644 tests/test_find_bad_tracks.py diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_find_bad_tracks.py b/tests/test_find_bad_tracks.py new file mode 100644 index 0000000..bb1bc28 --- /dev/null +++ b/tests/test_find_bad_tracks.py @@ -0,0 +1,21 @@ +from typing import cast, List + +from bpy.types import MovieClip, MovieTracking, MovieTrackingTrack, MovieTrackingTracks + +from find_bad_motion_tracks.find_bad_tracks import find_bad_tracks + + +def make_clip() -> MovieClip: + tracks: List[MovieTrackingTrack] = [] + + clip = MovieClip() + clip.frame_start = 0 + clip.frame_duration = 10 + clip.tracking = MovieTracking() + clip.tracking.tracks = cast(MovieTrackingTracks, tracks) + return clip + + +def test_find_bad_tracks_no_tracks(): + test_clip = make_clip() + find_bad_tracks(test_clip) diff --git a/tox.ini b/tox.ini index 227d140..b834334 100644 --- a/tox.ini +++ b/tox.ini @@ -1,8 +1,9 @@ [tox] # NOTE: Should match one of the [gh-actions] configs below -envlist = ruff-format, mypy, ruff-check +envlist = ruff-format, mypy, ruff-check, test ruff_version = 0.4.4 +pytest_version = 8.2.2 src_dir = find_bad_motion_tracks @@ -45,3 +46,11 @@ deps = # Auto-fix locally but not in CI commands = /bin/bash -c 'FIX="--fix" ; if [ "{env:CI:}" ] ; then FIX="--no-fix" ; fi ; ruff check $FIX {[tox]src_dir}' + +[testenv:test] +depends = ruff-format +deps = + pytest == {[tox]pytest_version} + -r requirements.txt +commands = + pytest --durations=10 --color=yes tests