diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d518cbe5..2f3587d6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,4 +52,4 @@ jobs: run: pip install pytest -r requirements-dev.txt - name: Run pytest - run: pytest -vv + run: pytest -vv --cov diff --git a/conf/v0.6/general/system/example_slurm_cluster.toml b/conf/v0.6/general/system/example_slurm_cluster.toml index 6eedd829..633d028c 100644 --- a/conf/v0.6/general/system/example_slurm_cluster.toml +++ b/conf/v0.6/general/system/example_slurm_cluster.toml @@ -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 diff --git a/pyproject.toml b/pyproject.toml index 2dedebf4..2f5c9281 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" diff --git a/requirements-dev.txt b/requirements-dev.txt index 33241661..5595722f 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -5,4 +5,4 @@ pandas-stubs==2.2.* pyright==1.1.359 build==1.2.* vulture==2.11 - +pytest-cov==5.0.* diff --git a/src/cloudai/schema/core/test_template.py b/src/cloudai/schema/core/test_template.py index 4e647c4c..a761b214 100644 --- a/src/cloudai/schema/core/test_template.py +++ b/src/cloudai/schema/core/test_template.py @@ -49,6 +49,8 @@ class TestTemplate: based on test outcomes. """ + __test__ = False + def __init__( self, system: System, diff --git a/tests/test_acceptance.py b/tests/test_acceptance.py new file mode 100644 index 00000000..2ae1fb84 --- /dev/null +++ b/tests/test_acceptance.py @@ -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"