Skip to content

Commit 00786c5

Browse files
Add pytest_configure to share a global variable
1 parent 863f587 commit 00786c5

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

tests/conftest.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import dpnp
3030
import numpy
3131
import pytest
32+
from .helper import check_support_float64
3233

3334

3435
skip_mark = pytest.mark.skip(reason='Skipping test.')
@@ -77,3 +78,6 @@ def pytest_collection_modifyitems(config, items):
7778
@pytest.fixture
7879
def allow_fall_back_on_numpy(monkeypatch):
7980
monkeypatch.setattr(dpnp.config, '__DPNP_RAISE_EXCEPION_ON_NUMPY_FALLBACK__', 0)
81+
82+
def pytest_configure():
83+
pytest.floatMAX = "float64" if check_support_float64() else "float32"

tests/helper.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,16 @@ def get_all_dtypes(no_bool=False,
3232
dtypes.append(dpnp.complex64)
3333
if dev.has_aspect_fp64:
3434
dtypes.append(dpnp.complex128)
35-
35+
3636
# add None value to validate a default dtype
3737
if not no_none:
3838
dtypes.append(None)
3939
return dtypes
40+
41+
def check_support_float64():
42+
"""
43+
Returns True if the default device supports 64-bit precision floating
44+
point operations, False otherwise.
45+
"""
46+
47+
return dpctl.select_default_device().has_aspect_fp64

0 commit comments

Comments
 (0)