Skip to content

Commit

Permalink
test[next]: Use pytest marker to skip GTIR test (fix spack build) (#1575
Browse files Browse the repository at this point in the history
)

The `import dace` statement causes the Spack build (spack-c2sm) to fail, in test stage, because dace is an optional dependency of GT4Py. This PR introduces a pytest marker to avoid this error.
  • Loading branch information
edopao committed Jul 11, 2024
1 parent df0f837 commit 146eebb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ markers = [
'requires_atlas: tests that require `atlas4py` bindings package',
'requires_dace: tests that require `dace` package',
'requires_gpu: tests that require a NVidia GPU (`cupy` and `cudatoolkit` are required)',
'starts_from_gtir_program: tests that require backend to start lowering from GTIR program',
'uses_applied_shifts: tests that require backend support for applied-shifts',
'uses_constant_fields: tests that require backend support for constant fields',
'uses_dynamic_offsets: tests that require backend support for dynamic offsets',
Expand Down
3 changes: 3 additions & 0 deletions tests/next_tests/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ class ProgramFormatterId(_PythonObjectIdMixin, str, enum.Enum):

# Test markers
REQUIRES_ATLAS = "requires_atlas"
# TODO(havogt): Remove, skipped during refactoring to GTIR
STARTS_FROM_GTIR_PROGRAM = "starts_from_gtir_program"
USES_APPLIED_SHIFTS = "uses_applied_shifts"
USES_CONSTANT_FIELDS = "uses_constant_fields"
USES_DYNAMIC_OFFSETS = "uses_dynamic_offsets"
Expand Down Expand Up @@ -135,6 +137,7 @@ class ProgramFormatterId(_PythonObjectIdMixin, str, enum.Enum):
# Common list of feature markers to skip
COMMON_SKIP_TEST_LIST = [
(REQUIRES_ATLAS, XFAIL, BINDINGS_UNSUPPORTED_MESSAGE),
(STARTS_FROM_GTIR_PROGRAM, SKIP, UNSUPPORTED_MESSAGE),
(USES_APPLIED_SHIFTS, XFAIL, UNSUPPORTED_MESSAGE),
(USES_IF_STMTS, XFAIL, UNSUPPORTED_MESSAGE),
(USES_NEGATIVE_MODULO, XFAIL, UNSUPPORTED_MESSAGE),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import gt4py.next as gtx
from gt4py.next.iterator.builtins import as_fieldop, cartesian_domain, deref, named_range
from gt4py.next.iterator.runtime import fendef, fundef, set_at
from gt4py.next.program_processors.runners import dace, gtfn

from next_tests.unit_tests.conftest import program_processor, run_processor

Expand All @@ -40,18 +39,10 @@ def copy_program(inp, out, size):
)


@pytest.mark.starts_from_gtir_program
def test_prog(program_processor):
program_processor, validate = program_processor

if program_processor in [
gtfn.run_gtfn.executor,
gtfn.run_gtfn_imperative.executor,
gtfn.run_gtfn_with_temporaries.executor,
dace.run_dace_cpu.executor,
]:
# TODO(havogt): Remove, skipped during refactoring to GTIR
pytest.skip("Executor requires to start from fencil.")

isize = 10
inp = gtx.as_field([I], np.arange(0, isize, dtype=np.float64))
out = gtx.as_field([I], np.zeros(shape=(isize,)))
Expand Down

0 comments on commit 146eebb

Please sign in to comment.