2929import yaml
3030from typer .testing import CliRunner
3131
32- from nemoguardrails . benchmark . aiperf .aiperf_models import AIPerfConfig , BaseConfig
33- from nemoguardrails . benchmark . aiperf .run_aiperf import AIPerfRunner , AIPerfSummary
32+ from aiperf .aiperf_models import AIPerfConfig , BaseConfig
33+ from aiperf .run_aiperf import AIPerfRunner , AIPerfSummary
3434
3535
3636@pytest .fixture
@@ -435,7 +435,8 @@ def test_build_command_with_missing_api_key_env_var(
435435 output_dir = tmp_path / "output"
436436
437437 with pytest .raises (
438- RuntimeError , match = "Environment variable 'MISSING_API_KEY' is not set. Please set it: export MISSING_API_KEY='your-api-key'"
438+ RuntimeError ,
439+ match = "Environment variable 'MISSING_API_KEY' is not set. Please set it: export MISSING_API_KEY='your-api-key'" ,
439440 ):
440441 runner ._build_command (None , output_dir )
441442
@@ -488,9 +489,7 @@ def test_build_command_ui_type_debug(self, create_config_file, tmp_path):
488489 output_dir = tmp_path / "output"
489490
490491 # Patch log.level to be DEBUG
491- with patch (
492- "nemoguardrails.benchmark.aiperf.run_aiperf.log.level" , logging .DEBUG
493- ):
492+ with patch ("aiperf.run_aiperf.log.level" , logging .DEBUG ):
494493 cmd = runner ._build_command (None , output_dir )
495494
496495 assert "--ui-type" in cmd
@@ -505,9 +504,7 @@ def test_build_command_ui_type_non_debug(self, create_config_file, tmp_path):
505504 output_dir = tmp_path / "output"
506505
507506 # Patch log.level to be INFO
508- with patch (
509- "nemoguardrails.benchmark.aiperf.run_aiperf.log.level" , logging .INFO
510- ):
507+ with patch ("aiperf.run_aiperf.log.level" , logging .INFO ):
511508 cmd = runner ._build_command (None , output_dir )
512509
513510 assert "--ui-type" in cmd
@@ -1141,12 +1138,10 @@ def test_cli_run_command_basic(self, create_config_file):
11411138 config_file = create_config_file ()
11421139 runner = CliRunner ()
11431140
1144- from nemoguardrails . benchmark . aiperf .run_aiperf import app
1141+ from aiperf .run_aiperf import app
11451142
11461143 # Mock the runner and service check
1147- with patch (
1148- "nemoguardrails.benchmark.aiperf.run_aiperf.AIPerfRunner"
1149- ) as mock_runner_class :
1144+ with patch ("aiperf.run_aiperf.AIPerfRunner" ) as mock_runner_class :
11501145 mock_runner = Mock ()
11511146 mock_runner .run .return_value = 0
11521147 mock_runner_class .return_value = mock_runner
@@ -1161,12 +1156,10 @@ def test_cli_run_command_with_verbose(self, create_config_file):
11611156 config_file = create_config_file ()
11621157 runner = CliRunner ()
11631158
1164- from nemoguardrails . benchmark . aiperf .run_aiperf import app
1159+ from aiperf .run_aiperf import app
11651160
11661161 # Mock the runner and service check
1167- with patch (
1168- "nemoguardrails.benchmark.aiperf.run_aiperf.AIPerfRunner"
1169- ) as mock_runner_class :
1162+ with patch ("aiperf.run_aiperf.AIPerfRunner" ) as mock_runner_class :
11701163 mock_runner = Mock ()
11711164 mock_runner .run .return_value = 0
11721165 mock_runner_class .return_value = mock_runner
@@ -1183,12 +1176,10 @@ def test_cli_run_command_with_dry_run(self, create_config_file):
11831176 config_file = create_config_file ()
11841177 runner = CliRunner ()
11851178
1186- from nemoguardrails . benchmark . aiperf .run_aiperf import app
1179+ from aiperf .run_aiperf import app
11871180
11881181 # Mock the runner and service check
1189- with patch (
1190- "nemoguardrails.benchmark.aiperf.run_aiperf.AIPerfRunner"
1191- ) as mock_runner_class :
1182+ with patch ("aiperf.run_aiperf.AIPerfRunner" ) as mock_runner_class :
11921183 mock_runner = Mock ()
11931184 mock_runner .run .return_value = 0
11941185 mock_runner_class .return_value = mock_runner
@@ -1205,12 +1196,10 @@ def test_cli_run_command_with_failure(self, create_config_file):
12051196 config_file = create_config_file ()
12061197 runner = CliRunner ()
12071198
1208- from nemoguardrails . benchmark . aiperf .run_aiperf import app
1199+ from aiperf .run_aiperf import app
12091200
12101201 # Mock the runner to return failure
1211- with patch (
1212- "nemoguardrails.benchmark.aiperf.run_aiperf.AIPerfRunner"
1213- ) as mock_runner_class :
1202+ with patch ("aiperf.run_aiperf.AIPerfRunner" ) as mock_runner_class :
12141203 mock_runner = Mock ()
12151204 mock_runner .run .return_value = 1 # Failure
12161205 mock_runner_class .return_value = mock_runner
0 commit comments