Skip to content

Commit c6d2518

Browse files
[pre-commit.ci] Add auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent d7fdc5f commit c6d2518

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

tests/vec_inf/cli/test_cli.py

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@
77
from unittest.mock import mock_open, patch
88

99
import pytest
10+
import requests
1011
import yaml
1112
from click.testing import CliRunner
12-
import requests
13-
import time
1413

1514
from vec_inf.cli._cli import cli
1615

@@ -374,7 +373,9 @@ def test_list_single_model(runner):
374373
assert "/model-weights" in result.output
375374

376375

377-
def test_metrics_command_pending_server(runner, mock_status_output, path_exists, debug_helper):
376+
def test_metrics_command_pending_server(
377+
runner, mock_status_output, path_exists, debug_helper
378+
):
378379
"""Test metrics command when server is pending."""
379380
with (
380381
patch("vec_inf.cli._utils.run_bash_command") as mock_run,
@@ -390,10 +391,15 @@ def test_metrics_command_pending_server(runner, mock_status_output, path_exists,
390391
assert result.exit_code == 0
391392
assert "Server State" in result.output
392393
assert "PENDING" in result.output
393-
assert "Metrics endpoint unavailable - Pending resources for server" in result.output
394+
assert (
395+
"Metrics endpoint unavailable - Pending resources for server"
396+
in result.output
397+
)
394398

395399

396-
def test_metrics_command_server_not_ready(runner, mock_status_output, path_exists, debug_helper):
400+
def test_metrics_command_server_not_ready(
401+
runner, mock_status_output, path_exists, debug_helper
402+
):
397403
"""Test metrics command when server is running but not ready."""
398404
with (
399405
patch("vec_inf.cli._utils.run_bash_command") as mock_run,
@@ -413,7 +419,9 @@ def test_metrics_command_server_not_ready(runner, mock_status_output, path_exist
413419

414420

415421
@patch("vec_inf.cli._helper.requests.get")
416-
def test_metrics_command_server_ready(mock_get, runner, mock_status_output, path_exists, debug_helper):
422+
def test_metrics_command_server_ready(
423+
mock_get, runner, mock_status_output, path_exists, debug_helper
424+
):
417425
"""Test metrics command when server is ready and returning metrics."""
418426
metrics_response = """
419427
# HELP vllm:prompt_tokens_total Number of prefill tokens processed.
@@ -450,7 +458,9 @@ def test_metrics_command_server_ready(mock_get, runner, mock_status_output, path
450458

451459

452460
@patch("vec_inf.cli._helper.requests.get")
453-
def test_metrics_command_request_failed(mock_get, runner, mock_status_output, path_exists, debug_helper):
461+
def test_metrics_command_request_failed(
462+
mock_get, runner, mock_status_output, path_exists, debug_helper
463+
):
454464
"""Test metrics command when request to metrics endpoint fails."""
455465
mock_get.side_effect = requests.exceptions.RequestException("Connection refused")
456466

@@ -469,5 +479,8 @@ def test_metrics_command_request_failed(mock_get, runner, mock_status_output, pa
469479
# KeyboardInterrupt is expected and ok
470480
assert "Server State" in result.output
471481
assert "RUNNING" in result.output
472-
assert "Metrics request failed, `metrics` endpoint might not be ready" in result.output
482+
assert (
483+
"Metrics request failed, `metrics` endpoint might not be ready"
484+
in result.output
485+
)
473486
assert "Connection refused" in result.output

0 commit comments

Comments
 (0)