Skip to content

Commit e5c12f4

Browse files
committed
Implements a pytest marker for tests currently broken for complex data types on some platforms
The marker "broken_complex" can be used to skip these broken tests. Running the tests with `pytest --runcomplex` permits running the test.
1 parent 66eaf79 commit e5c12f4

File tree

4 files changed

+31
-0
lines changed

4 files changed

+31
-0
lines changed

dpctl/tests/conftest.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import os
2121
import sys
2222

23+
import pytest
2324
from _device_attributes_checks import (
2425
check,
2526
device_selector,
@@ -38,3 +39,28 @@
3839
"suppress_invalid_numpy_warnings",
3940
"valid_filter",
4041
]
42+
43+
44+
def pytest_configure(config):
45+
config.addinivalue_line(
46+
"markers",
47+
"broken_complex: Specified again to remove warnings ",
48+
)
49+
50+
51+
def pytest_addoption(parser):
52+
parser.addoption(
53+
"--runcomplex",
54+
action="store_true",
55+
default=False,
56+
help="run broken complex tests",
57+
)
58+
59+
60+
def pytest_collection_modifyitems(config, items):
61+
if config.getoption("--runcomplex"):
62+
return
63+
skip_complex = pytest.mark.skip(reason="need --runcomplex option to run")
64+
for item in items:
65+
if "broken_complex" in item.keywords:
66+
item.add_marker(skip_complex)

dpctl/tests/elementwise/test_hyperbolic.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ def test_hyper_real_special_cases(np_call, dpt_call, dtype):
270270
assert_allclose(dpt.asnumpy(dpt_call(yf)), Y_np, atol=tol, rtol=tol)
271271

272272

273+
@pytest.mark.broken_complex
273274
@pytest.mark.parametrize("np_call, dpt_call", _all_funcs)
274275
@pytest.mark.parametrize("dtype", ["c8", "c16"])
275276
def test_hyper_complex_special_cases(np_call, dpt_call, dtype):

dpctl/tests/elementwise/test_trigonometric.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ def test_trig_real_special_cases(np_call, dpt_call, dtype):
267267
assert_allclose(dpt.asnumpy(dpt_call(yf)), Y_np, atol=tol, rtol=tol)
268268

269269

270+
@pytest.mark.broken_complex
270271
@pytest.mark.parametrize("np_call, dpt_call", _all_funcs)
271272
@pytest.mark.parametrize("dtype", ["c8", "c16"])
272273
def test_trig_complex_special_cases(np_call, dpt_call, dtype):

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ omit = [
3333
]
3434

3535
[tool.pytest.ini.options]
36+
markers = [
37+
"broken_complex: mark a test that is skipped due to complex implementation",
38+
]
3639
minversion = "6.0"
3740
norecursedirs= [
3841
".*", "*.egg*", "build", "dist", "conda-recipe",

0 commit comments

Comments
 (0)