Skip to content

Commit d22f8d5

Browse files
Merge 4aded88 into 89b03eb
2 parents 89b03eb + 4aded88 commit d22f8d5

File tree

152 files changed

+1177
-1133
lines changed

Some content is hidden

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

152 files changed

+1177
-1133
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

.github/workflows/conda-package.yml

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -20,49 +20,49 @@ env:
2020
RUN_TESTS_MAX_ATTEMPTS: 2
2121
TEST_ENV_NAME: 'test'
2222
TEST_SCOPE: >-
23-
test_absolute.py
24-
test_amin_amax.py
25-
test_arithmetic.py
26-
test_arraycreation.py
27-
test_arraymanipulation.py
28-
test_bitwise.py
29-
test_copy.py
30-
test_counting.py
31-
test_fft.py
32-
test_flat.py
33-
test_histogram.py
34-
test_indexing.py
35-
test_linalg.py
36-
test_logic.py
37-
test_manipulation.py
38-
test_mathematical.py
39-
test_mixins.py
40-
test_nanfunctions.py
41-
test_ndarray.py
42-
test_outer.py
43-
test_product.py
44-
test_random_state.py
45-
test_search.py
46-
test_sort.py
47-
test_special.py
48-
test_statistics.py
49-
test_sum.py
50-
test_sycl_queue.py
51-
test_umath.py
52-
test_usm_type.py
53-
third_party/cupy/core_tests
54-
third_party/cupy/fft_tests
55-
third_party/cupy/creation_tests
56-
third_party/cupy/indexing_tests
57-
third_party/cupy/lib_tests
58-
third_party/cupy/linalg_tests
59-
third_party/cupy/logic_tests
60-
third_party/cupy/manipulation_tests
61-
third_party/cupy/math_tests
62-
third_party/cupy/sorting_tests
63-
third_party/cupy/statistics_tests/test_histogram.py
64-
third_party/cupy/statistics_tests/test_meanvar.py
65-
third_party/cupy/test_ndim.py
23+
tests/test_absolute.py
24+
tests/test_amin_amax.py
25+
tests/test_arithmetic.py
26+
tests/test_arraycreation.py
27+
tests/test_arraymanipulation.py
28+
tests/test_bitwise.py
29+
tests/test_copy.py
30+
tests/test_counting.py
31+
tests/test_fft.py
32+
tests/test_flat.py
33+
tests/test_histogram.py
34+
tests/test_indexing.py
35+
tests/test_linalg.py
36+
tests/test_logic.py
37+
tests/test_manipulation.py
38+
tests/test_mathematical.py
39+
tests/test_mixins.py
40+
tests/test_nanfunctions.py
41+
tests/test_ndarray.py
42+
tests/test_outer.py
43+
tests/test_product.py
44+
tests/test_random_state.py
45+
tests/test_search.py
46+
tests/test_sort.py
47+
tests/test_special.py
48+
tests/test_statistics.py
49+
tests/test_sum.py
50+
tests/test_sycl_queue.py
51+
tests/test_umath.py
52+
tests/test_usm_type.py
53+
tests/third_party/cupy/core_tests
54+
tests/third_party/cupy/fft_tests
55+
tests/third_party/cupy/creation_tests
56+
tests/third_party/cupy/indexing_tests
57+
tests/third_party/cupy/lib_tests
58+
tests/third_party/cupy/linalg_tests
59+
tests/third_party/cupy/logic_tests
60+
tests/third_party/cupy/manipulation_tests
61+
tests/third_party/cupy/math_tests
62+
tests/third_party/cupy/sorting_tests
63+
tests/third_party/cupy/statistics_tests/test_histogram.py
64+
tests/third_party/cupy/statistics_tests/test_meanvar.py
65+
tests/third_party/cupy/test_ndim.py
6666
VER_JSON_NAME: 'version.json'
6767
VER_SCRIPT1: "import json; f = open('version.json', 'r'); j = json.load(f); f.close(); "
6868
VER_SCRIPT2: "d = j['dpnp'][0]; print('='.join((d[s] for s in ('version', 'build'))))"
@@ -177,7 +177,7 @@ jobs:
177177
channel-path: '${{ github.workspace }}/channel/'
178178
pkg-path-in-channel: '${{ github.workspace }}/channel/linux-64/'
179179
extracted-pkg-path: '${{ github.workspace }}/pkg/'
180-
tests-path: '${{ github.workspace }}/pkg/info/test/tests/'
180+
# tests-path: '${{ github.workspace }}/pkg/info/test/tests/'
181181
ver-json-path: '${{ github.workspace }}/version.json'
182182

183183
steps:
@@ -258,7 +258,7 @@ jobs:
258258
if: env.RERUN_TESTS_ON_FAILURE != 'true'
259259
run: |
260260
python -m pytest -q -ra --disable-warnings -vv ${{ env.TEST_SCOPE }}
261-
working-directory: ${{ env.tests-path }}
261+
# working-directory: ${{ env.tests-path }}
262262

263263
- name: Run tests
264264
if: env.RERUN_TESTS_ON_FAILURE == 'true'

.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.

0 commit comments

Comments
 (0)