Skip to content

Commit 032a1a0

Browse files
nv-hwoomc-nv
authored andcommitted
Initialize logger to capture logs
1 parent 49673de commit 032a1a0

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/c++/perf_analyzer/genai-perf/tests/test_cli.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
from pathlib import Path
2828

29+
import genai_perf.logging as logging
2930
import pytest
3031
from genai_perf import __version__, parser
3132
from genai_perf.llm_inputs.llm_inputs import OutputFormat, PromptSource
@@ -248,11 +249,15 @@ def test_default_profile_export_filepath(
248249
assert captured.out == ""
249250

250251
@pytest.mark.parametrize(
251-
"arg, expected_path",
252+
"arg, expected_path, expected_output",
252253
[
253254
(
254255
["--model", "strange/test_model"],
255256
"artifacts/strange_test_model-triton-tensorrtllm-concurrency1",
257+
(
258+
"Model name 'strange/test_model' cannot be used to create "
259+
"artifact directory. Instead, 'strange_test_model' will be used"
260+
),
256261
),
257262
(
258263
[
@@ -264,17 +269,24 @@ def test_default_profile_export_filepath(
264269
"chat",
265270
],
266271
"artifacts/hello_world_test_model-openai-chat-concurrency1",
272+
(
273+
"Model name 'hello/world/test_model' cannot be used to create "
274+
"artifact directory. Instead, 'hello_world_model' will be used"
275+
),
267276
),
268277
],
269278
)
270-
def test_model_name_artifact_path(self, monkeypatch, arg, expected_path, capsys):
279+
def test_model_name_artifact_path(
280+
self, monkeypatch, arg, expected_path, expected_output, capsys
281+
):
282+
logging.init_logging()
271283
combined_args = ["genai-perf"] + arg
272284
monkeypatch.setattr("sys.argv", combined_args)
273285
args, extra_args = parser.parse_args()
274286

275287
assert args.artifact_dir == Path(expected_path)
276288
captured = capsys.readouterr()
277-
assert captured.out == ""
289+
assert expected_output in captured.out
278290

279291
def test_default_load_level(self, monkeypatch, capsys):
280292
monkeypatch.setattr("sys.argv", ["genai-perf", "--model", "test_model"])

0 commit comments

Comments
 (0)