From f49cc7e9fd8a47af17edd1f014f67a0082b02222 Mon Sep 17 00:00:00 2001 From: Hannes Vogt Date: Thu, 3 Dec 2026 17:18:02 +0100 Subject: [PATCH 1/2] test[next]: cover all condition combinations in test_conditionals --- .../feature_tests/ffront_tests/test_conditionals.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_conditionals.py b/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_conditionals.py index d23cea4d0c..0b6098a186 100644 --- a/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_conditionals.py +++ b/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_conditionals.py @@ -45,7 +45,8 @@ def simple_if(a: cases.IField, b: cases.IField, condition: bool) -> cases.IField # TODO(tehrengruber): test with fields on different domains @pytest.mark.uses_scalar_in_control_flow -@pytest.mark.parametrize("condition1, condition2", [[True, False], [True, False]]) +@pytest.mark.parametrize("condition1", [True, False]) +@pytest.mark.parametrize("condition2", [True, False]) @pytest.mark.uses_if_stmts def test_simple_if_conditional(condition1, condition2, cartesian_case): @field_operator @@ -207,7 +208,8 @@ def both_branches_return(a: cases.IField, b: cases.IField, condition: bool) -> c @pytest.mark.uses_scalar_in_control_flow -@pytest.mark.parametrize("condition1, condition2", [[True, False], [True, False]]) +@pytest.mark.parametrize("condition1", [True, False]) +@pytest.mark.parametrize("condition2", [True, False]) @pytest.mark.uses_if_stmts def test_nested_if_stmt_conditional(cartesian_case, condition1, condition2): @field_operator @@ -281,7 +283,8 @@ def nested_if(a: cases.IField, b: cases.IField, condition: bool) -> cases.IField @pytest.mark.uses_scalar_in_control_flow -@pytest.mark.parametrize("condition1, condition2", [[True, False], [True, False]]) +@pytest.mark.parametrize("condition1", [True, False]) +@pytest.mark.parametrize("condition2", [True, False]) @pytest.mark.uses_if_stmts def test_if_without_else(cartesian_case, condition1, condition2): @field_operator From 44e757e6628c127eab2e0bc87c26b49af65f4af1 Mon Sep 17 00:00:00 2001 From: Hannes Vogt Date: Thu, 3 Dec 2026 17:18:02 +0100 Subject: [PATCH 2/2] ci: run tests/core_tests in a new test_core nox session --- .cscs-ci/default.yml | 8 +++--- .github/workflows/daily-ci.yml | 2 +- .github/workflows/test-components.yml | 2 ++ nox-sessions-config.yml | 11 ++++++++ noxfile.py | 37 +++++++++++++++++++++++++++ 5 files changed, 55 insertions(+), 5 deletions(-) diff --git a/.cscs-ci/default.yml b/.cscs-ci/default.yml index c40d9fefb4..c58a088138 100644 --- a/.cscs-ci/default.yml +++ b/.cscs-ci/default.yml @@ -56,17 +56,17 @@ build_cscs_amd_rocm: SUBVARIANT: ['cuda13', 'rocm7', 'cpu'] DETAIL: ["nomesh", "atlas"] PY_VERSION: *test_python_versions - - SUBPACKAGE: [storage] + - SUBPACKAGE: [core, storage] VARIANT: ['cuda13', 'rocm7', 'cpu'] PY_VERSION: *test_python_versions rules: &exclude_variants_rules # Extended jobs should reference this list anchor at the proper position of their # `rules` section, and also add an extra `- when: on_success` rule at the end. - - if: '($SUBVARIANT == "cpu" || ($SUBPACKAGE == "storage" && $VARIANT == "cpu")) && ($TEST_VARIANTS !~ /(^|\s)cpu(\s|$)/)' + - if: '($SUBVARIANT == "cpu" || ($SUBPACKAGE =~ /^(core|storage)$/ && $VARIANT == "cpu")) && ($TEST_VARIANTS !~ /(^|\s)cpu(\s|$)/)' when: never - - if: '($SUBVARIANT == "cuda13" || ($SUBPACKAGE == "storage" && $VARIANT == "cuda13")) && ($TEST_VARIANTS !~ /(^|\s)cuda13(\s|$)/)' + - if: '($SUBVARIANT == "cuda13" || ($SUBPACKAGE =~ /^(core|storage)$/ && $VARIANT == "cuda13")) && ($TEST_VARIANTS !~ /(^|\s)cuda13(\s|$)/)' when: never - - if: '($SUBVARIANT == "rocm7" || ($SUBPACKAGE == "storage" && $VARIANT == "rocm7")) && ($TEST_VARIANTS !~ /(^|\s)rocm7(\s|$)/)' + - if: '($SUBVARIANT == "rocm7" || ($SUBPACKAGE =~ /^(core|storage)$/ && $VARIANT == "rocm7")) && ($TEST_VARIANTS !~ /(^|\s)rocm7(\s|$)/)' when: never script: diff --git a/.github/workflows/daily-ci.yml b/.github/workflows/daily-ci.yml index f025f8f82e..5bce511d86 100644 --- a/.github/workflows/daily-ci.yml +++ b/.github/workflows/daily-ci.yml @@ -36,7 +36,7 @@ jobs: # between the different compatible versions for a given package requirement # [arg: --resolution, env: UV_RESOLUTION=] dependencies-strategy: ["lowest-direct", "highest"] - gt4py-module: ["cartesian", "eve", "next", "storage"] + gt4py-module: ["cartesian", "core", "eve", "next", "storage"] os: ["ubuntu-latest", "macos-latest"] python-version: ${{ fromJSON(needs.get-python-versions.outputs.python-versions) }} fail-fast: false diff --git a/.github/workflows/test-components.yml b/.github/workflows/test-components.yml index fca9696746..30e850bd34 100644 --- a/.github/workflows/test-components.yml +++ b/.github/workflows/test-components.yml @@ -73,6 +73,8 @@ jobs: args: "(internal, cpu)" - name: test_cartesian args: "(dace, cpu)" + - name: test_core + args: "(cpu)" - name: test_eve args: "" - name: test_next diff --git a/nox-sessions-config.yml b/nox-sessions-config.yml index d5cb4ea696..6f2c71ee7d 100644 --- a/nox-sessions-config.yml +++ b/nox-sessions-config.yml @@ -10,6 +10,17 @@ sessions: - "*.md" - "*.rst" + - name: test_core + paths: # Run when gt4py._core files (or package settings) are changed + - "src/gt4py/_core/**" + - "tests/core_tests/**" + - ".github/workflows/**" + - ".cscs-ci/**" + - "*.lock" + - "*.toml" + - "*.yml" + - "noxfile.py" + - name: test_eve paths: # Run when gt4py.eve files (or package settings) are changed - "src/gt4py/eve/**" diff --git a/noxfile.py b/noxfile.py index 0e3558aa66..973607d8f4 100755 --- a/noxfile.py +++ b/noxfile.py @@ -47,6 +47,9 @@ "test_cartesian-3.13(dace, cpu)", "test_cartesian-3.14(internal, cpu)", "test_cartesian-3.14(dace, cpu)", + "test_core-3.12(cpu)", + "test_core-3.13(cpu)", + "test_core-3.14(cpu)", "test_eve-3.12", "test_eve-3.13", "test_eve-3.14", @@ -251,6 +254,40 @@ def test_cartesian( ) +@nox.session(python=PYTHON_VERSIONS, tags=["cartesian", "next"]) +@nox.parametrize("device", [*DeviceNoxParam.values()]) +def test_core( + session: nox.Session, + device: DeviceOption, +) -> None: + """Run selected 'gt4py._core' tests.""" + + device_settings = DeviceTestSettings[device] + extras = ["standard", "testing", *device_settings["extras"]] + markers = list(device_settings["markers"]) + if device == "cpu": + extras.append("jax") + if _session_runs_torch(session, device): + extras.append("torch") + else: + markers.append("not requires_torch") + else: + markers += ["not requires_jax", "not requires_torch"] + + install_session_venv(session, extras=extras, groups=["test"]) + + session.run( + *"pytest --cache-clear -sv -n auto --dist loadgroup".split(), + # An unmet `requires_*` marker means a broken environment. Fail loudly + # instead of skipping all tests due to the auto-skip in 'tests/conftest.py'. + # Applies to every `requires_*`: install the extra, or exclude the marker. + "--require-optional-deps", + *("-m", " and ".join(markers)), + str(pathlib.Path("tests") / "core_tests"), + *session.posargs, + ) + + @nox.session(python=PYTHON_VERSIONS, tags=["cartesian", "next", "cpu"]) def test_eve(session: nox.Session) -> None: """Run 'gt4py.eve' tests."""