11import glob
2+
23import pytest
4+
35from dlclive import benchmark_videos , download_benchmarking_data
46from dlclive .engine import Engine
57
@@ -10,7 +12,9 @@ def datafolder(tmp_path):
1012 download_benchmarking_data (str (datafolder ))
1113 return datafolder
1214
15+
1316@pytest .mark .functional
17+ @pytest .mark .slow
1418def test_benchmark_script_runs_tf_backend (tmp_path , datafolder ):
1519 dog_models = glob .glob (str (datafolder / "dog" / "*[!avi]" ))
1620 dog_video = glob .glob (str (datafolder / "dog" / "*.avi" ))[0 ]
@@ -27,11 +31,7 @@ def test_benchmark_script_runs_tf_backend(tmp_path, datafolder):
2731 print (f"Running dog model: { model_path } " )
2832 benchmark_videos (
2933 model_path = model_path ,
30- model_type = (
31- "base"
32- if Engine .from_model_path (model_path ) == Engine .TENSORFLOW
33- else "pytorch"
34- ),
34+ model_type = ("base" if Engine .from_model_path (model_path ) == Engine .TENSORFLOW else "pytorch" ),
3535 video_path = dog_video ,
3636 output = str (out_dir ),
3737 n_frames = n_frames ,
@@ -42,11 +42,7 @@ def test_benchmark_script_runs_tf_backend(tmp_path, datafolder):
4242 print (f"Running mouse model: { model_path } " )
4343 benchmark_videos (
4444 model_path = model_path ,
45- model_type = (
46- "base"
47- if Engine .from_model_path (model_path ) == Engine .TENSORFLOW
48- else "pytorch"
49- ),
45+ model_type = ("base" if Engine .from_model_path (model_path ) == Engine .TENSORFLOW else "pytorch" ),
5046 video_path = mouse_video ,
5147 output = str (out_dir ),
5248 n_frames = n_frames ,
@@ -58,6 +54,7 @@ def test_benchmark_script_runs_tf_backend(tmp_path, datafolder):
5854
5955@pytest .mark .parametrize ("model_name" , ["hrnet_w32" , "resnet_50" ])
6056@pytest .mark .functional
57+ @pytest .mark .slow
6158def test_benchmark_script_with_torch_modelzoo (tmp_path , datafolder , model_name ):
6259 from dlclive import modelzoo
6360
@@ -107,4 +104,4 @@ def test_benchmark_script_with_torch_modelzoo(tmp_path, datafolder, model_name):
107104 # Assertions: verify output files were created
108105 output_files = list (out_dir .iterdir ())
109106 assert len (output_files ) > 0 , "No output files were created by benchmark_videos"
110- assert any (f .suffix == ".pickle" for f in output_files ), "No pickle files found in output directory"
107+ assert any (f .suffix == ".pickle" for f in output_files ), "No pickle files found in output directory"
0 commit comments