Skip to content

Commit ab5ed63

Browse files
Add default exclusion of slow tests in pytest (#1831)
* Register slow and multi_gpu marks for pytest * Add default exclusion of slow tests in pytest * Add @testing.slow for test_matmul_large * Remove test skip for dpnp.power * Remove unused import in test_sumprod.py * Add filterwarnings to markers * Remove -p no:warnings from pytest addopts * Undo commit with remove -p no:warnings --------- Co-authored-by: Anton <[email protected]>
1 parent 119e979 commit ab5ed63

File tree

3 files changed

+10
-26
lines changed

3 files changed

+10
-26
lines changed

setup.cfg

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,17 @@ max_line_length = 120
33
ignore = E201
44

55
[tool:pytest]
6-
addopts = -p no:warnings --tb=short
6+
# By default, tests marked as slow will be deselected.
7+
# To run all tests, use -m "slow and not slow".
8+
# To run only slow tests, use -m "slow".
9+
addopts = -m "not slow" -p no:warnings --tb=short --strict-markers
710
norecursedirs = tests_perf
811
testpaths = tests
12+
markers =
13+
slow: marks tests as slow (deselect with '-m "not slow"')
14+
multi_gpu: marks tests that require a specified number of GPUs
15+
# Added due to -p no:warnings to avoid errors with --strict-markers
16+
filterwarnings: mark to filter warnings during tests
917

1018
[versioneer]
1119
VCS = git

tests/test_mathematical.py

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -813,16 +813,6 @@ def test_op_with_scalar(array, val, func, data_type, val_type):
813813
pytest.skip(
814814
"(0j ** 0) is different: (NaN + NaNj) in dpnp and (1 + 0j) in numpy"
815815
)
816-
# TODO: Remove when #1378 (dpctl) is solved and 2024.1 is released (coverage is failing otherwise)
817-
elif (
818-
is_cpu_device()
819-
and dpnp_a.dtype == dpnp.complex128
820-
and dpnp_a.size >= 8
821-
and not dpnp.all(dpnp_a)
822-
):
823-
pytest.skip(
824-
"[..., 0j ** val] is different for x.size >= 8: [..., NaN + NaNj] in dpnp and [..., 0 + 0j] in numpy"
825-
)
826816

827817
if func == "subtract" and val_type == bool and data_type == dpnp.bool:
828818
with pytest.raises(TypeError):
@@ -1287,19 +1277,6 @@ def test_power(array, val, data_type, val_type):
12871277
dpnp_a = dpnp.array(array, dtype=data_type)
12881278
val_ = val_type(val)
12891279

1290-
# TODO: Remove when #1378 (dpctl) is solved and 2024.1 is released (coverage is failing otherwise)
1291-
if (
1292-
is_cpu_device()
1293-
and (
1294-
dpnp.complex128 in (data_type, val_type)
1295-
or dpnp.complex64 in (data_type, val_type)
1296-
)
1297-
and dpnp_a.size >= 8
1298-
):
1299-
pytest.skip(
1300-
"[..., 0j ** val] is different for x.size >= 8: [..., NaN + NaNj] in dpnp and [..., 0 + 0j] in numpy"
1301-
)
1302-
13031280
result = dpnp.power(dpnp_a, val_)
13041281
expected = numpy.power(np_a, val_)
13051282
assert_allclose(expected, result, rtol=1e-6)
@@ -2647,7 +2624,7 @@ def test_matmul_out_0D(self, out_shape):
26472624
assert result is dpnp_out
26482625
assert_dtype_allclose(result, expected)
26492626

2650-
@pytest.mark.skipif(is_cpu_device(), reason="large size")
2627+
@testing.slow
26512628
@pytest.mark.parametrize(
26522629
"shape",
26532630
[

tests/third_party/cupy/math_tests/test_sumprod.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from tests.helper import (
99
has_support_aspect16,
1010
has_support_aspect64,
11-
is_win_platform,
1211
)
1312
from tests.third_party.cupy import testing
1413

0 commit comments

Comments
 (0)