Skip to content

Commit 300c5d5

Browse files
Merge d4253ae into 89b03eb
2 parents 89b03eb + d4253ae commit 300c5d5

File tree

151 files changed

+1128
-1084
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

151 files changed

+1128
-1084
lines changed

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ exclude =
5656
build,
5757
dpnp/to_numba/*.py,
5858
conda.recipe,
59-
tests/*.py,
59+
dpnp/tests/*.py,
6060
tests_external/*.py,
6161
versioneer.py,
6262

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ repos:
3232
- id: python-no-eval
3333
exclude: |
3434
(?x)^(
35-
tests/test_arraycreation.py|
36-
tests/test_sycl_queue.py|
37-
tests/test_usm_type.py
35+
dpnp/tests/test_arraycreation.py|
36+
dpnp/tests/test_sycl_queue.py|
37+
dpnp/tests/test_usm_type.py
3838
)$
3939
- id: python-no-log-warn
4040
- id: python-use-type-annotations

MANIFEST.in

Lines changed: 0 additions & 2 deletions
This file was deleted.

conda-recipe/meta.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,6 @@ test:
5050
requires:
5151
- pytest
5252
- setuptools
53-
source_files:
54-
- examples
55-
- tests
56-
- setup.cfg
57-
commands:
58-
- python -c "import dpnp; print(dpnp.__version__)"
59-
- python -m dpctl -f
60-
- pytest -s
6153

6254
about:
6355
home: https://github.com/IntelPython/dpnp

conda-recipe/run_test.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,15 @@ if [ -n "${TBBROOT}" ]; then
2626
# shellcheck source=/dev/null
2727
. "${TBBROOT}"/env/vars.sh
2828
fi
29+
30+
# If PYTHON is not set
31+
# assign it to the Python interpreter from the testing environment
32+
if [ -z "${PYTHON}" ]; then
33+
PYTHON=$PREFIX/bin/python
34+
fi
35+
36+
set -e
37+
38+
$PYTHON -c "import dpctl; print(dpctl.__version__)"
39+
$PYTHON -m dpctl -f
40+
$PYTHON -m pytest -q -ra --disable-warnings --pyargs dpnp

tests/__init__.py renamed to dpnp/tests/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import numpy
22

3-
from tests import testing
3+
from dpnp.tests import testing
44

55
numpy.testing.assert_allclose = testing.assert_allclose
66
numpy.testing.assert_array_equal = testing.assert_array_equal

tests/conftest.py renamed to dpnp/tests/conftest.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,45 @@ def get_excluded_tests(test_exclude_file):
5050
return excluded_tests
5151

5252

53+
def pytest_configure(config):
54+
# By default, tests marked as slow will be deselected.
55+
# To run all tests, use -m "slow or not slow".
56+
# To run only slow tests, use -m "slow".
57+
# Equivalent to addopts = -m "not slow"
58+
if not config.getoption("markexpr"):
59+
config.option.markexpr = "not slow"
60+
# Equivalent to addopts = --tb=short
61+
if not config.getoption("tbstyle"):
62+
config.option.tbstyle = "short"
63+
# Equivalent to addopts = --strict-markers
64+
if not config.getoption("strict_markers"):
65+
config.option.strict_markers = True
66+
67+
# Register pytest markers
68+
config.addinivalue_line(
69+
"markers", "slow: marks tests as slow (deselect with '-m \"not slow\"')"
70+
)
71+
config.addinivalue_line(
72+
"markers",
73+
"multi_gpu: marks tests that require a specified number of GPUs",
74+
)
75+
76+
# Add warning filters
77+
# pkg_resources
78+
config.addinivalue_line(
79+
"filterwarnings",
80+
"ignore:pkg_resources is deprecated as an API:DeprecationWarning",
81+
)
82+
# NumPy arccosh
83+
# Undefined behavior depends on the backend:
84+
# NumPy with OpenBLAS for np.array[1.0] does not raise a warning
85+
# while numpy with OneMKL raises RuntimeWarning
86+
config.addinivalue_line(
87+
"filterwarnings",
88+
"ignore:invalid value encountered in arccosh:RuntimeWarning",
89+
)
90+
91+
5392
def pytest_collection_modifyitems(config, items):
5493
test_path = os.path.split(__file__)[0]
5594
excluded_tests = []
@@ -95,6 +134,14 @@ def pytest_collection_modifyitems(config, items):
95134
if test_name == item_tbl_str:
96135
item.add_marker(skip_mark)
97136

137+
# Handle the exclusion of tests marked as "slow"
138+
selected_marker = config.getoption("markexpr")
139+
if "not slow" in selected_marker:
140+
skip_slow = pytest.mark.skip(reason="Skipping slow tests")
141+
for item in items:
142+
if "slow" in item.keywords:
143+
item.add_marker(skip_slow)
144+
98145

99146
@pytest.fixture
100147
def allow_fall_back_on_numpy(monkeypatch):
File renamed without changes.

dpnp/tests/skipped_tests.tbl

Lines changed: 364 additions & 0 deletions
Large diffs are not rendered by default.

dpnp/tests/skipped_tests_gpu.tbl

Lines changed: 374 additions & 0 deletions
Large diffs are not rendered by default.

dpnp/tests/skipped_tests_gpu_no_fp64.tbl

Lines changed: 172 additions & 0 deletions
Large diffs are not rendered by default.
File renamed without changes.
File renamed without changes.

tests/test_arithmetic.py renamed to dpnp/tests/test_arithmetic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
import numpy
44

5-
from tests.helper import has_support_aspect64
6-
from tests.third_party.cupy import testing
5+
from .helper import has_support_aspect64
6+
from .third_party.cupy import testing
77

88

99
class TestArithmetic(unittest.TestCase):
File renamed without changes.

tests/test_arraymanipulation.py renamed to dpnp/tests/test_arraymanipulation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
)
1111

1212
import dpnp
13-
from tests.third_party.cupy import testing
1413

1514
from .helper import get_all_dtypes, get_float_complex_dtypes
15+
from .third_party.cupy import testing
1616

1717

1818
class TestAtleast1d:
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

tests/test_linalg.py renamed to dpnp/tests/test_linalg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
)
1515

1616
import dpnp as inp
17-
from tests.third_party.cupy import testing
1817

1918
from .helper import (
2019
assert_dtype_allclose,
@@ -25,6 +24,7 @@
2524
has_support_aspect64,
2625
is_cpu_device,
2726
)
27+
from .third_party.cupy import testing
2828

2929

3030
def vvsort(val, vec, size, xp):
File renamed without changes.

tests/test_manipulation.py renamed to dpnp/tests/test_manipulation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from numpy.testing import assert_array_equal, assert_equal, assert_raises
88

99
import dpnp
10-
from tests.third_party.cupy import testing
1110

1211
from .helper import (
1312
assert_dtype_allclose,
@@ -18,6 +17,7 @@
1817
get_integer_dtypes,
1918
has_support_aspect64,
2019
)
20+
from .third_party.cupy import testing
2121

2222
testdata = []
2323
testdata += [

tests/test_mathematical.py renamed to dpnp/tests/test_mathematical.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
import dpnp
2121
from dpnp.dpnp_array import dpnp_array
22-
from tests.third_party.cupy import testing
2322

2423
from .helper import (
2524
assert_dtype_allclose,
@@ -36,6 +35,7 @@
3635
_get_numpy_arrays_2in_1out,
3736
_get_output_data_type,
3837
)
38+
from .third_party.cupy import testing
3939

4040

4141
class TestAngle:

tests/test_mixins.py renamed to dpnp/tests/test_mixins.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import unittest
22

3-
from tests.third_party.cupy import testing
3+
from .third_party.cupy import testing
44

55

66
class TestMatMul(unittest.TestCase):

tests/test_nanfunctions.py renamed to dpnp/tests/test_nanfunctions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
)
1111

1212
import dpnp
13-
from tests.third_party.cupy import testing
1413

1514
from .helper import (
1615
assert_dtype_allclose,
@@ -20,6 +19,7 @@
2019
get_float_dtypes,
2120
has_support_aspect64,
2221
)
22+
from .third_party.cupy import testing
2323

2424

2525
class TestNanArgmaxNanArgmin:
File renamed without changes.

tests/test_outer.py renamed to dpnp/tests/test_outer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
from numpy.testing import assert_raises
66

77
import dpnp as dp
8-
from tests.third_party.cupy import testing
8+
9+
from .third_party.cupy import testing
910

1011

1112
class TestOuter(unittest.TestCase):
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

tests/test_sum.py renamed to dpnp/tests/test_sum.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
)
88

99
import dpnp
10-
from tests.helper import (
10+
11+
from .helper import (
1112
assert_dtype_allclose,
1213
get_all_dtypes,
1314
get_float_dtypes,
File renamed without changes.
File renamed without changes.
File renamed without changes.

tests/testing/__init__.py renamed to dpnp/tests/testing/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from tests.testing.array import (
1+
from dpnp.tests.testing.array import (
22
assert_allclose,
33
assert_array_equal,
44
assert_equal,
File renamed without changes.
File renamed without changes.

tests/tests_perf/math_tests/test_black_scholes.py renamed to dpnp/tests/tests_perf/math_tests/test_black_scholes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import numpy
44
import pytest
55

6-
from tests.tests_perf.data_generator import *
7-
from tests.tests_perf.test_perf_base import DPNPTestPerfBase
6+
from dpnp.tests.tests_perf.data_generator import *
7+
from dpnp.tests.tests_perf.test_perf_base import DPNPTestPerfBase
88

99
SEED = 7777777
1010
SL, SH = 10.0, 50.0

tests/tests_perf/math_tests/test_dpnp.py renamed to dpnp/tests/tests_perf/math_tests/test_dpnp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
import pytest
33

44
import dpnp
5-
from tests.tests_perf.data_generator import *
6-
from tests.tests_perf.test_perf_base import DPNPTestPerfBase
5+
from dpnp.tests.tests_perf.data_generator import *
6+
from dpnp.tests.tests_perf.test_perf_base import DPNPTestPerfBase
77

88

99
class TestDPNP(DPNPTestPerfBase):

tests/tests_perf/math_tests/test_mathematical.py renamed to dpnp/tests/tests_perf/math_tests/test_mathematical.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import numpy
22
import pytest
33

4-
from tests.tests_perf.data_generator import *
5-
from tests.tests_perf.test_perf_base import DPNPTestPerfBase
4+
from dpnp.tests.tests_perf.data_generator import *
5+
from dpnp.tests.tests_perf.test_perf_base import DPNPTestPerfBase
66

77

88
class TestDPNPMathematical(DPNPTestPerfBase):

tests/tests_perf/math_tests/test_trigonometric.py renamed to dpnp/tests/tests_perf/math_tests/test_trigonometric.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
import pytest
33

44
import dpnp
5-
from tests.tests_perf.data_generator import *
6-
from tests.tests_perf.test_perf_base import DPNPTestPerfBase
5+
from dpnp.tests.tests_perf.data_generator import *
6+
from dpnp.tests.tests_perf.test_perf_base import DPNPTestPerfBase
77

88

99
def cos_2_args(input_A, input_B, lib):
File renamed without changes.

tests/third_party/cupy/binary_tests/test_elementwise.py renamed to dpnp/tests/third_party/cupy/binary_tests/test_elementwise.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import unittest
22

3-
from tests.third_party.cupy import testing
3+
from dpnp.tests.third_party.cupy import testing
44

55

66
class TestElementwise(unittest.TestCase):

tests/third_party/cupy/core_tests/test_core.py renamed to dpnp/tests/third_party/cupy/core_tests/test_core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import pytest
66

77
import dpnp as cupy
8-
from tests.third_party.cupy import testing
8+
from dpnp.tests.third_party.cupy import testing
99

1010

1111
class TestSize(unittest.TestCase):

tests/third_party/cupy/core_tests/test_core_elementwise.py renamed to dpnp/tests/third_party/cupy/core_tests/test_core_elementwise.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import pytest
55

66
import dpnp as cupy
7-
from tests.third_party.cupy import testing
7+
from dpnp.tests.third_party.cupy import testing
88

99

1010
class TestElementwise(unittest.TestCase):

tests/third_party/cupy/core_tests/test_dlpack.py renamed to dpnp/tests/third_party/cupy/core_tests/test_dlpack.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import pytest
77

88
import dpnp as cupy
9-
from tests.third_party.cupy import testing
9+
from dpnp.tests.third_party.cupy import testing
1010

1111

1212
def _gen_array(dtype, alloc_q=None):

tests/third_party/cupy/core_tests/test_flags.py renamed to dpnp/tests/third_party/cupy/core_tests/test_flags.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import pytest
55

66
import dpnp as cupy
7-
from tests.third_party.cupy import testing
7+
from dpnp.tests.third_party.cupy import testing
88

99

1010
@pytest.mark.skip("class Flags is not exposed")

tests/third_party/cupy/core_tests/test_ndarray.py renamed to dpnp/tests/third_party/cupy/core_tests/test_ndarray.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from dpctl.tensor._numpy_helper import AxisError
88

99
import dpnp as cupy
10-
from tests.third_party.cupy import testing
10+
from dpnp.tests.third_party.cupy import testing
1111

1212

1313
def get_array_module(*args):

tests/third_party/cupy/core_tests/test_ndarray_complex_ops.py renamed to dpnp/tests/third_party/cupy/core_tests/test_ndarray_complex_ops.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
import pytest
55

66
import dpnp as cupy
7-
from tests.helper import has_support_aspect64
8-
from tests.third_party.cupy import testing
7+
from dpnp.tests.helper import has_support_aspect64
8+
from dpnp.tests.third_party.cupy import testing
99

1010

1111
class TestConj(unittest.TestCase):

tests/third_party/cupy/core_tests/test_ndarray_conversion.py renamed to dpnp/tests/third_party/cupy/core_tests/test_ndarray_conversion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import pytest
55

66
import dpnp as cupy
7-
from tests.third_party.cupy import testing
7+
from dpnp.tests.third_party.cupy import testing
88

99

1010
@testing.parameterize(

tests/third_party/cupy/core_tests/test_ndarray_copy_and_view.py renamed to dpnp/tests/third_party/cupy/core_tests/test_ndarray_copy_and_view.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import pytest
33

44
import dpnp as cupy
5-
from tests.third_party.cupy import testing
5+
from dpnp.tests.third_party.cupy import testing
66

77
if numpy.lib.NumpyVersion(numpy.__version__) >= "2.0.0b1":
88
from numpy.exceptions import ComplexWarning

tests/third_party/cupy/core_tests/test_ndarray_math.py renamed to dpnp/tests/third_party/cupy/core_tests/test_ndarray_math.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import numpy
44
import pytest
55

6-
from tests.helper import has_support_aspect64
7-
from tests.third_party.cupy import testing
6+
from dpnp.tests.helper import has_support_aspect64
7+
from dpnp.tests.third_party.cupy import testing
88

99

1010
@testing.parameterize(

tests/third_party/cupy/core_tests/test_ndarray_reduction.py renamed to dpnp/tests/third_party/cupy/core_tests/test_ndarray_reduction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import dpnp as cupy
77

88
# from cupy.core import _accelerator
9-
from tests.third_party.cupy import testing
9+
from dpnp.tests.third_party.cupy import testing
1010

1111

1212
@testing.parameterize(

tests/third_party/cupy/core_tests/test_ndarray_unary_op.py renamed to dpnp/tests/third_party/cupy/core_tests/test_ndarray_unary_op.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import pytest
66

77
import dpnp as cupy
8-
from tests.third_party.cupy import testing
8+
from dpnp.tests.third_party.cupy import testing
99

1010

1111
class TestArrayBoolOp(unittest.TestCase):

0 commit comments

Comments
 (0)