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,27 @@ def test_huggingface_url_with_folder_structure():
307307 )
308308
309309
310+
311+ class TestFormatElapsed :
312+ def test_under_one_minute (self ):
313+ assert _format_elapsed (5.3 ) == "5.3s"
314+
315+ def test_fractional_seconds (self ):
316+ assert _format_elapsed (0.4 ) == "0.4s"
317+
318+ def test_exactly_sixty_seconds (self ):
319+ assert _format_elapsed (60 ) == "1m 0s"
320+
321+ def test_minutes_and_seconds (self ):
322+ assert _format_elapsed (154 ) == "2m 34s"
323+
324+ def test_over_one_hour (self ):
325+ assert _format_elapsed (3661 ) == "1h 1m 1s"
326+
327+ def test_large_duration (self ):
328+ assert _format_elapsed (7384 ) == "2h 3m 4s"
329+
330+
310331# ---------------------------------------------------------------------------
311332# --downloader CLI option tests
312333# ---------------------------------------------------------------------------
@@ -327,7 +348,7 @@ def test_downloader_flag_forwarded(self, tmp_path):
327348 patch ("comfy_cli.tracking.track_command" , lambda _cmd : lambda fn : fn ),
328349 ):
329350 mock_ui .prompt_input .side_effect = ["mymodel.bin" , "" ]
330- runner .invoke (
351+ result = runner .invoke (
331352 app ,
332353 [
333354 "download" ,
@@ -343,6 +364,7 @@ def test_downloader_flag_forwarded(self, tmp_path):
343364 assert mock_dl .called
344365 _ , kwargs = mock_dl .call_args
345366 assert kwargs .get ("downloader" ) == "aria2"
367+ assert "Done in " in result .output
346368
347369 def test_default_from_config (self , tmp_path ):
348370 """Config default_downloader is used when no --downloader flag."""
0 commit comments