Skip to content

Skip rather than xfail on CI #92

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/numpy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ jobs:
env:
ARRAY_API_TESTS_MODULE: numpy.array_api
run: |
# Mark some known issues as XFAIL
cat << EOF >> xfails.txt
# Skip test cases with known issues
cat << EOF >> skips.txt

# copy not implemented
array_api_tests/test_creation_functions.py::test_asarray_arrays
Expand Down
1 change: 1 addition & 0 deletions array_api_tests/test_linalg.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ def true_diag(x_stack):

_test_stacks(linalg.diagonal, x, **kw, res=res, dims=1, true_val=true_diag)

@pytest.mark.skip(reason="Inputs need to be restricted") # TODO
@pytest.mark.xp_extension('linalg')
@given(x=symmetric_matrices(finite=True))
def test_eigh(x):
Expand Down
10 changes: 1 addition & 9 deletions array_api_tests/test_statistical_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,7 @@ def test_mean(x, data):
ph.assert_keepdimable_shape(
"mean", out.shape, x.shape, _axes, kw.get("keepdims", False), **kw
)
for indices, out_idx in zip(sh.axes_ndindex(x.shape, _axes), sh.ndindex(out.shape)):
mean = float(out[out_idx])
assume(not math.isinf(mean)) # mean may become inf due to internal overflows
elements = []
for idx in indices:
s = float(x[idx])
elements.append(s)
expected = sum(elements) / len(elements)
ph.assert_scalar_equals("mean", float, out_idx, mean, expected)
# Values testing mean is too finicky


@given(
Expand Down
16 changes: 8 additions & 8 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ def xp_has_ext(ext: str) -> bool:
return False


xfail_ids = []
xfails_path = Path(__file__).parent / "xfails.txt"
if xfails_path.exists():
with open(xfails_path) as f:
skip_ids = []
skips_path = Path(__file__).parent / "skips.txt"
if skips_path.exists():
with open(skips_path) as f:
for line in f:
if line.startswith("array_api_tests"):
id_ = line.strip("\n")
xfail_ids.append(id_)
skip_ids.append(id_)


def pytest_collection_modifyitems(config, items):
Expand All @@ -96,10 +96,10 @@ def pytest_collection_modifyitems(config, items):
)
elif not xp_has_ext(ext):
item.add_marker(mark.skip(reason=f"{ext} not found in array module"))
# xfail if specified in xfails.txt
for id_ in xfail_ids:
# skip if specified in skips.txt
for id_ in skip_ids:
if item.nodeid.startswith(id_):
item.add_marker(mark.xfail(reason="xfails.txt"))
item.add_marker(mark.skip(reason="skips.txt"))
break
# skip if test not appropiate for CI
if ci:
Expand Down