Skip to content

Commit

Permalink
Merge pull request #6 from NVIDIA/acc-tests
Browse files Browse the repository at this point in the history
Acceptence tests
  • Loading branch information
srinivas212 committed May 16, 2024
2 parents 0fbd138 + b35f84a commit dd671cf
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ jobs:
run: pip install pytest -r requirements-dev.txt

- name: Run pytest
run: pytest -vv
run: pytest -vv --cov
2 changes: 1 addition & 1 deletion conf/v0.6/general/system/example_slurm_cluster.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ scheduler = "slurm"

install_path = "./install"
output_path = "./results"
default_partition = "DEFAULT_PARTITION"
default_partition = "partition_1"

gpus_per_node = 8
ntasks_per_node = 8
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ select = ["I", "B", "E", "F", "SIM", "W", "C90", "EXE"]

[tool.ruff.format]
indent-style = "space"

[tool.pytest.ini_options]
test_dir = "tests"
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ pandas-stubs==2.2.*
pyright==1.1.359
build==1.2.*
vulture==2.11

pytest-cov==5.0.*
2 changes: 2 additions & 0 deletions src/cloudai/schema/core/test_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ class TestTemplate:
based on test outcomes.
"""

__test__ = False

def __init__(
self,
system: System,
Expand Down
30 changes: 30 additions & 0 deletions tests/test_acceptance.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import argparse
from pathlib import Path

import pytest
from cloudai.__main__ import handle_dry_run_and_run

SLURM_TEST_SCENARIOS = [
Path("conf/v0.6/general/test_scenario/sleep/test_scenario.toml"),
Path("conf/v0.6/general/test_scenario/ucc_test/test_scenario.toml"),
]


@pytest.mark.parametrize("test_scenario_path", SLURM_TEST_SCENARIOS, ids=lambda x: str(x))
def test_slurm(tmp_path: Path, test_scenario_path: Path):
args = argparse.Namespace(
log_file=None,
log_level=None,
mode="dry-run",
output_path=str(tmp_path),
system_config_path="conf/v0.6/general/system/example_slurm_cluster.toml",
test_scenario_path=str(test_scenario_path),
test_path="conf/v0.6/general/test",
test_template_path="conf/v0.6/general/test_template",
)
handle_dry_run_and_run(args)

test_dir = list(tmp_path.glob("*"))[0]
for td in test_dir.iterdir():
assert td.is_dir(), "Invalid test directory"
assert "Tests." in td.name, "Invalid test directory name"

0 comments on commit dd671cf

Please sign in to comment.