Skip to content

Commit

Permalink
ci: Fail CI if xfails pass unexpectedly (#1888)
Browse files Browse the repository at this point in the history
Be strict about tests marked with xfail. If they pass unexpectedly, fail the testsuite instead of logging an XPASS.
  • Loading branch information
romanc authored Feb 26, 2025
1 parent 194d27a commit 3ba7e62
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ markers = [
'uses_sparse_fields_as_output: tests that require backend support for writing sparse fields',
'uses_strided_neighbor_offset: tests that require backend support for strided neighbor offset',
'uses_tuple_args: tests that require backend support for tuple arguments',
'uses_tuple_args_with_different_but_promotable_dims: test that requires backend support for tuple args with different but promotable dims',
'uses_tuple_iterator: tests that require backend support to deref tuple iterators',
'uses_tuple_returns: tests that require backend support for tuple results',
'uses_zero_dimensional_fields: tests that require backend support for zero-dimensional fields',
Expand All @@ -330,6 +331,7 @@ markers = [
]
norecursedirs = ['dist', 'build', 'cpp_backend_tests/build*', '_local/*', '.*']
testpaths = 'tests'
xfail_strict = true

# -- ruff --
[tool.ruff]
Expand Down
5 changes: 5 additions & 0 deletions tests/next_tests/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ class ProgramFormatterId(_PythonObjectIdMixin, str, enum.Enum):
USES_REDUCTION_WITH_ONLY_SPARSE_FIELDS = "uses_reduction_with_only_sparse_fields"
USES_STRIDED_NEIGHBOR_OFFSET = "uses_strided_neighbor_offset"
USES_TUPLE_ARGS = "uses_tuple_args"
USES_TUPLES_ARGS_WITH_DIFFERENT_BUT_PROMOTABLE_DIMS = (
"uses_tuple_args_with_different_but_promotable_dims"
)
USES_TUPLE_ITERATOR = "uses_tuple_iterator"
USES_TUPLE_RETURNS = "uses_tuple_returns"
USES_ZERO_DIMENSIONAL_FIELDS = "uses_zero_dimensional_fields"
Expand All @@ -139,6 +142,7 @@ class ProgramFormatterId(_PythonObjectIdMixin, str, enum.Enum):
(USES_NEGATIVE_MODULO, XFAIL, UNSUPPORTED_MESSAGE),
(USES_REDUCTION_WITH_ONLY_SPARSE_FIELDS, XFAIL, REDUCTION_WITH_ONLY_SPARSE_FIELDS_MESSAGE),
(USES_SPARSE_FIELDS_AS_OUTPUT, XFAIL, UNSUPPORTED_MESSAGE),
(USES_TUPLES_ARGS_WITH_DIFFERENT_BUT_PROMOTABLE_DIMS, XFAIL, UNSUPPORTED_MESSAGE),
]
# Markers to skip because of missing features in the domain inference
DOMAIN_INFERENCE_SKIP_LIST = [
Expand Down Expand Up @@ -168,6 +172,7 @@ class ProgramFormatterId(_PythonObjectIdMixin, str, enum.Enum):
]
ROUNDTRIP_SKIP_LIST = DOMAIN_INFERENCE_SKIP_LIST + [
(USES_SPARSE_FIELDS_AS_OUTPUT, XFAIL, UNSUPPORTED_MESSAGE),
(USES_TUPLES_ARGS_WITH_DIFFERENT_BUT_PROMOTABLE_DIMS, XFAIL, UNSUPPORTED_MESSAGE),
]
GTFN_SKIP_TEST_LIST = (
COMMON_SKIP_TEST_LIST
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,7 @@ def testee(a: tuple[int32, tuple[int32, cases.IField, int32]]) -> cases.IField:


@pytest.mark.uses_tuple_args
@pytest.mark.xfail(
reason="Not implemented in frontend (implicit size arg handling needs to be adopted) and GTIR embedded backend."
)
@pytest.mark.uses_tuple_args_with_different_but_promotable_dims
def test_tuple_arg_with_different_but_promotable_dims(cartesian_case):
@gtx.field_operator
def testee(a: tuple[cases.IField, cases.IJField]) -> cases.IJField:
Expand Down

0 comments on commit 3ba7e62

Please sign in to comment.