44import typer .testing
55
66from comfy_cli import constants
7- from comfy_cli .command .models .models import app , check_civitai_url , check_huggingface_url , list_models
7+ from comfy_cli .command .models .models import _format_elapsed , app , check_civitai_url , check_huggingface_url , list_models
88
99
1010def _make_model_tree (tmp_path : pathlib .Path ) -> pathlib .Path :
@@ -307,6 +307,31 @@ def test_huggingface_url_with_folder_structure():
307307 )
308308
309309
310+ # ---------------------------------------------------------------------------
311+ # _format_elapsed tests
312+ # ---------------------------------------------------------------------------
313+
314+
315+ class TestFormatElapsed :
316+ def test_under_one_minute (self ):
317+ assert _format_elapsed (5.3 ) == "5.3s"
318+
319+ def test_fractional_seconds (self ):
320+ assert _format_elapsed (0.4 ) == "0.4s"
321+
322+ def test_exactly_sixty_seconds (self ):
323+ assert _format_elapsed (60 ) == "1m 0s"
324+
325+ def test_minutes_and_seconds (self ):
326+ assert _format_elapsed (154 ) == "2m 34s"
327+
328+ def test_over_one_hour (self ):
329+ assert _format_elapsed (3661 ) == "1h 1m 1s"
330+
331+ def test_large_duration (self ):
332+ assert _format_elapsed (7384 ) == "2h 3m 4s"
333+
334+
310335# ---------------------------------------------------------------------------
311336# --downloader CLI option tests
312337# ---------------------------------------------------------------------------
@@ -327,7 +352,7 @@ def test_downloader_flag_forwarded(self, tmp_path):
327352 patch ("comfy_cli.tracking.track_command" , lambda _cmd : lambda fn : fn ),
328353 ):
329354 mock_ui .prompt_input .side_effect = ["mymodel.bin" , "" ]
330- runner .invoke (
355+ result = runner .invoke (
331356 app ,
332357 [
333358 "download" ,
@@ -343,6 +368,7 @@ def test_downloader_flag_forwarded(self, tmp_path):
343368 assert mock_dl .called
344369 _ , kwargs = mock_dl .call_args
345370 assert kwargs .get ("downloader" ) == "aria2"
371+ assert "Done in " in result .output
346372
347373 def test_default_from_config (self , tmp_path ):
348374 """Config default_downloader is used when no --downloader flag."""
0 commit comments