Skip to content
Open
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
1 change: 0 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ exclude =
dpnp/_version.py,
conda.recipe,
dpnp/tests/*.py,
tests_external/*.py,

# Print detailed statistic if any issue detected
count = True
Expand Down
19 changes: 13 additions & 6 deletions dpnp/tests/config.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
import os

all_int_types = bool(os.getenv("DPNP_TEST_ALL_INT_TYPES", 0))
float16_types = bool(os.getenv("DPNP_TEST_FLOAT_16", 0))
complex_types = bool(os.getenv("DPNP_TEST_COMPLEX_TYPES", 0))
bool_types = bool(os.getenv("DPNP_TEST_BOOL_TYPES", 0))
skip_tensor_tests = bool(int(os.getenv("SKIP_TENSOR_TESTS", 0)))

def _getenv_bool(name):
# unset, empty, "0", "false", "no" and "off" mean disabled
value = os.getenv(name, "").strip().lower()
return value not in ("", "0", "false", "no", "off")

infra_warnings_enable = bool(os.getenv("DPNP_INFRA_WARNINGS_ENABLE", 0))

all_int_types = _getenv_bool("DPNP_TEST_ALL_INT_TYPES")
float16_types = _getenv_bool("DPNP_TEST_FLOAT_16")
complex_types = _getenv_bool("DPNP_TEST_COMPLEX_TYPES")
bool_types = _getenv_bool("DPNP_TEST_BOOL_TYPES")
skip_tensor_tests = _getenv_bool("SKIP_TENSOR_TESTS")


infra_warnings_enable = _getenv_bool("DPNP_INFRA_WARNINGS_ENABLE")
infra_warnings_directory = os.getenv("DPNP_INFRA_WARNINGS_DIRECTORY", None)
infra_warnings_events_artifact = os.getenv(
"DPNP_INFRA_WARNINGS_EVENTS_ARTIFACT",
Expand Down
17 changes: 0 additions & 17 deletions dpnp/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,6 @@ def pytest_collection_modifyitems(config, items):
# global skip file, where gpu device is not supported
test_exclude_file_gpu = os.path.join(test_path, "skipped_tests_gpu.tbl")

# global skip file, where gpu device with no fp64 support
test_exclude_file_gpu_no_fp64 = os.path.join(
test_path, "skipped_tests_gpu_no_fp64.tbl"
)

# global skip file for cuda backend
test_exclude_file_cuda = os.path.join(test_path, "skipped_tests_cuda.tbl")

Expand All @@ -161,10 +156,6 @@ def pytest_collection_modifyitems(config, items):
print("")
if is_gpu or os.getenv("DPNP_QUEUE_GPU") == "1":
excluded_tests.extend(get_excluded_tests(test_exclude_file_gpu))
if not support_fp64:
excluded_tests.extend(
get_excluded_tests(test_exclude_file_gpu_no_fp64)
)
if is_cuda:
excluded_tests.extend(get_excluded_tests(test_exclude_file_cuda))
else:
Expand All @@ -178,14 +169,6 @@ def pytest_collection_modifyitems(config, items):
if test_name == item_tbl:
item.add_marker(skip_mark)

# Handle the exclusion of tests marked as "slow"
selected_marker = config.getoption("markexpr")
if "not slow" in selected_marker:
skip_slow = pytest.mark.skip(reason="Skipping slow tests")
for item in items:
if "slow" in item.keywords:
item.add_marker(skip_slow)


def pytest_runtest_teardown(item, nextitem):
"""
Expand Down
3 changes: 2 additions & 1 deletion dpnp/tests/third_party/cupy/binary_tests/test_packing.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import pytest

import dpnp as cupy
from dpnp.exceptions import USMAllocationError
from dpnp.tests.third_party.cupy import testing

pytest.skip(
Expand Down Expand Up @@ -71,7 +72,7 @@ def test_packbits_large_input(self, bitorder, expected):
a[-1] = 1
packed = cupy.packbits(a, bitorder=bitorder)
assert packed[-1] == expected
except MemoryError:
except USMAllocationError:
pytest.skip("out of memory in test.")
finally:
del packed, a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import pytest

import dpnp as cupy
from dpnp.exceptions import USMAllocationError
from dpnp.tests.third_party.cupy import testing


Expand Down Expand Up @@ -986,7 +987,7 @@ def test_advanced(self):
arr[idx, :] = cupy.array([[3], [3], [3]], dtype=cupy.int8)
# Check 3 got written (order may not be strictly guaranteed)
assert arr.sum() == 2**30 * 3
except MemoryError:
except USMAllocationError:
pytest.skip("out of memory in test.")

@testing.slow
Expand All @@ -1003,7 +1004,7 @@ def test_take_array(self):
testing.assert_array_equal(res[0, -1], [1, 2])
testing.assert_array_equal(res[1, 0], [3, 4])
testing.assert_array_equal(res[1, -1], [3, 4])
except MemoryError:
except USMAllocationError:
pytest.skip("out of memory in test.")
finally:
del res, indices, arr
Expand All @@ -1020,7 +1021,7 @@ def test_take_scalar(self):
res = arr.take(1, axis=0)
assert res[0] == 2
assert res[-1] == 2
except MemoryError:
except USMAllocationError:
pytest.skip("out of memory in test.")
finally:
del res, arr
Expand All @@ -1034,5 +1035,5 @@ def test_choose(self):
res = choices[1, :].choose(choices)
# sanity check, we mostly care about it not crashing.
assert res.sum() == 2**31
except MemoryError:
except USMAllocationError:
pytest.skip("out of memory in test.")
5 changes: 3 additions & 2 deletions dpnp/tests/third_party/cupy/creation_tests/test_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import pytest

import dpnp as cupy
from dpnp.exceptions import USMAllocationError
from dpnp.tests.helper import has_support_aspect64
from dpnp.tests.third_party.cupy import testing

Expand Down Expand Up @@ -138,7 +139,7 @@ def test_large_number_of_rows(self):
out = cupy.tri(2**31 + 1, 1, k=0, dtype=cupy.uint8)
assert out[0, 0] == 1
assert out[-1, 0] == 1
except MemoryError:
except USMAllocationError:
pytest.skip("out of memory in test.")
finally:
del out
Expand All @@ -152,7 +153,7 @@ def test_large_number_of_columns(self):
out = cupy.tri(1, 2**31, k=2**31 - 1, dtype=cupy.uint8)
assert out[0, 0] == 1
assert out[0, -1] == 1
except MemoryError:
except USMAllocationError:
pytest.skip("out of memory in test.")
finally:
del out
Expand Down
3 changes: 2 additions & 1 deletion dpnp/tests/third_party/cupy/linalg_tests/test_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import pytest

import dpnp as cupy
from dpnp.exceptions import USMAllocationError
from dpnp.tests.helper import has_support_aspect64
from dpnp.tests.third_party.cupy import testing
from dpnp.tests.third_party.cupy.testing._helper import skip_if_after_baseline
Expand Down Expand Up @@ -561,7 +562,7 @@ def test_integer_tensordot_large_indexing():
try:
a = cupy.zeros((2, k), dtype=cupy.uint8)
b = cupy.zeros((k, m), dtype=cupy.uint8)
except MemoryError:
except USMAllocationError:
pytest.skip("out of memory in test.")

# Select the second row, which is zero. The overflowing bound clamps
Expand Down
12 changes: 6 additions & 6 deletions dpnp/tests/third_party/cupy/math_tests/test_sumprod.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# import cupy._core._accelerator as _acc
# import cupy.cuda.cutensor
# from cupy._core import _cub_reduction
from dpnp.exceptions import AxisError
from dpnp.exceptions import AxisError, USMAllocationError
from dpnp.tests.helper import (
has_support_aspect16,
has_support_aspect64,
Expand Down Expand Up @@ -496,7 +496,7 @@ def test_reduce(self, shape, axis, dtype, part):
testing.assert_array_equal(
a.argmax(axis), cupy.full(p.shape, 0)
)
except MemoryError:
except USMAllocationError:
pytest.skip("out of memory in test.")

@pytest.mark.parametrize("dtype", [numpy.int8, numpy.int32, numpy.float32])
Expand All @@ -513,7 +513,7 @@ def test_cumsum_size_over_int32_max(self, dtype):
testing.assert_allclose(float(out[-1]), expected, rtol=2e-4)
else:
assert int(out[-1]) == expected
except MemoryError:
except USMAllocationError:
pytest.skip("out of memory in test.")

@pytest.mark.parametrize("dtype", [numpy.int8, numpy.int32, numpy.float32])
Expand All @@ -526,7 +526,7 @@ def test_cumprod_size_over_int32_max(self, dtype):
a[-1] = 3
out = a.cumprod()
assert out[-1] == 6 # product of array
except MemoryError:
except USMAllocationError:
pytest.skip("out of memory in test.")


Expand Down Expand Up @@ -1035,7 +1035,7 @@ def test_cumsum_axis(self, shape):
a[:, 0] = 1
a[:, -1] = 1
cupy.cumsum(a, axis=1, out=a)
except MemoryError:
except USMAllocationError:
pytest.skip("out of memory in test.")
# leading 1 plus trailing 1: 1 everywhere, last column is 2
n_cols = a.shape[1]
Expand All @@ -1047,7 +1047,7 @@ def test_cumprod_axis(self, shape):
a = cupy.ones(shape, dtype=numpy.uint8)
a[:, 0] = 2
cupy.cumprod(a, axis=1, out=a)
except MemoryError:
except USMAllocationError:
pytest.skip("out of memory in test.")
# a leading 2 followed by ones gives 2 everywhere
self._spot_check(a, lambda col: 2)
Expand Down
42 changes: 0 additions & 42 deletions dpnp/tests/third_party/numpy_ext/__init__.py

This file was deleted.

Empty file removed tests_external/__init__.py
Empty file.
Empty file removed tests_external/numpy/__init__.py
Empty file.
Loading
Loading