Skip to content

Commit c3556cf

Browse files
committed
test(performance): align flat recipe unit coverage
Signed-off-by: yaoyu-33 <yaoyu.094@gmail.com>
1 parent 88a7dd4 commit c3556cf

2 files changed

Lines changed: 11 additions & 13 deletions

File tree

‎tests/unit_tests/recipes/test_override_precedence.py‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,23 @@
2323

2424
import sys
2525
from pathlib import Path
26+
from unittest.mock import MagicMock, patch
27+
28+
import pytest
2629

2730

2831
SCRIPTS_PERF_PATH = Path(__file__).parents[3] / "scripts" / "performance"
2932
sys.path.insert(0, str(SCRIPTS_PERF_PATH))
3033

3134

35+
@pytest.fixture(autouse=True)
36+
def _mock_cuda_device_properties():
37+
"""Keep recipe construction independent of the test host's GPUs."""
38+
properties = MagicMock(major=9, name="NVIDIA H100")
39+
with patch("torch.cuda.get_device_properties", return_value=properties):
40+
yield
41+
42+
3243
def _build_base_args(**overrides):
3344
"""Return a fully-populated argparse.Namespace using the real parser defaults.
3445

‎tests/unit_tests/scripts/performance/test_perf_plugins.py‎

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ def test_set_determinism_env_vars_writes_three_keys():
4646
gpu="h100",
4747
compute_dtype="bf16",
4848
train_task="pretrain",
49-
num_gpus=64,
5049
)
5150
executor = MagicMock()
5251
executor.env_vars = {}
@@ -56,15 +55,3 @@ def test_set_determinism_env_vars_writes_three_keys():
5655
assert executor.env_vars["NCCL_ALGO"] == "Ring"
5756
assert executor.env_vars["NVTE_ALLOW_NONDETERMINISTIC_ALGO"] == "0"
5857
assert executor.env_vars["CUBLAS_WORKSPACE_CONFIG"] == ":4096:8"
59-
60-
61-
def test_perf_env_plugin_num_gpus_is_optional():
62-
plugin = PerfEnvPlugin(
63-
model_family_name="llama",
64-
model_recipe_name="llama3_70b",
65-
gpu="h100",
66-
compute_dtype="bf16",
67-
train_task="pretrain",
68-
)
69-
70-
assert plugin.num_gpus is None

0 commit comments

Comments
 (0)