Skip to content

Commit

Permalink
Fix test errors
Browse files Browse the repository at this point in the history
  • Loading branch information
lkomali committed Aug 7, 2024
1 parent e511930 commit 45480cf
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions genai-perf/tests/test_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
import pytest
from genai_perf import parser
from genai_perf.constants import DEFAULT_GRPC_URL
from genai_perf.telemetry_data.triton_telemetry_data_collector import (
TritonTelemetryDataCollector,
)

Check notice

Code scanning / CodeQL

Unused import Note test

Import of 'TritonTelemetryDataCollector' is not used.
from genai_perf.wrapper import Profiler


Expand Down Expand Up @@ -147,11 +150,17 @@ def test_service_openai(self, monkeypatch, arg):
assert cmd_string.count(" -i http") == 1

@patch("genai_perf.wrapper.subprocess.run")
def test_stdout_verbose(self, mock_subprocess_run):
@patch("genai_perf.wrapper.TritonTelemetryDataCollector")
def test_stdout_verbose(self, mock_telemetry_collector, mock_subprocess_run):
args = MagicMock()
args.model = "test_model"
args.verbose = True
Profiler.run(args=args, extra_args=None)
telemetry_data_collector = mock_telemetry_collector.return_value
Profiler.run(
telemetry_data_collector=telemetry_data_collector,
args=args,
extra_args=None,
)

# Check that standard output was not redirected.
for call_args in mock_subprocess_run.call_args_list:
Expand All @@ -161,11 +170,17 @@ def test_stdout_verbose(self, mock_subprocess_run):
), "With the verbose flag, stdout should not be redirected."

@patch("genai_perf.wrapper.subprocess.run")
def test_stdout_not_verbose(self, mock_subprocess_run):
@patch("genai_perf.wrapper.TritonTelemetryDataCollector")
def test_stdout_not_verbose(self, mock_telemetry_collector, mock_subprocess_run):
args = MagicMock()
args.model = "test_model"
args.verbose = False
Profiler.run(args=args, extra_args=None)
telemetry_data_collector = mock_telemetry_collector.return_value
Profiler.run(
telemetry_data_collector=telemetry_data_collector,
args=args,
extra_args=None,
)

# Check that standard output was redirected.
for call_args in mock_subprocess_run.call_args_list:
Expand Down

0 comments on commit 45480cf

Please sign in to comment.