Skip to content
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
3e42166
Move tests to dpnp folder
vlad-perevezentsev Sep 25, 2024
c9a0622
Update import paths for dpnp tests
vlad-perevezentsev Sep 25, 2024
2755aab
Update paths in skipped_tests files
vlad-perevezentsev Sep 25, 2024
223e4a4
Update import paths in tests_perf
vlad-perevezentsev Sep 25, 2024
cda88b5
Update import paths in cupy/testing
vlad-perevezentsev Sep 25, 2024
39fdc4e
Update import paths in all cupy tests
vlad-perevezentsev Sep 26, 2024
0a91a52
Merge master into move_tests_folder
vlad-perevezentsev Oct 16, 2024
be7a9c0
Update tests path in pyproject.toml
vlad-perevezentsev Oct 16, 2024
a976f39
Remove MANIFEST.in
vlad-perevezentsev Oct 17, 2024
82b5568
Add tests folder to conda package
vlad-perevezentsev Oct 17, 2024
4c6c78f
Simplify meta.yaml: move test logic to run_test.sh
vlad-perevezentsev Oct 17, 2024
db2a453
Move pytest config from setup.cfg to conftest.py
vlad-perevezentsev Oct 17, 2024
d4253ae
Update call pytest in gen_coverage.py
vlad-perevezentsev Oct 17, 2024
8088e3a
Update path to cupy.testing in some tests
vlad-perevezentsev Oct 18, 2024
4aded88
Update test paths for github action test_linux
vlad-perevezentsev Oct 18, 2024
7e97155
Undo moving tests to dpnp folder
vlad-perevezentsev Oct 24, 2024
a8b7f75
Copy tests folder to conda package
vlad-perevezentsev Oct 25, 2024
81c0850
Undo updating paths in skipped files
vlad-perevezentsev Oct 25, 2024
5776a63
Undo updating tests paths in pyproject.toml
vlad-perevezentsev Oct 25, 2024
df9e0a4
Optimize test skipping and path normalization in conftest.py
vlad-perevezentsev Oct 25, 2024
6d697db
Merge master into move_tests_folder
vlad-perevezentsev Oct 25, 2024
ec45c7c
Add norecursedirs config for tests_perf in conftest.py
vlad-perevezentsev Oct 25, 2024
ec23647
Use relative imports in tests/testing
vlad-perevezentsev Oct 25, 2024
e6c4ea3
Use relative imports in tests/tests_perf
vlad-perevezentsev Oct 25, 2024
a8e91e0
Use relative imports for dpnp tests
vlad-perevezentsev Oct 25, 2024
b99d7b1
Use relative imports in tests/third_party/cupy/testing/
vlad-perevezentsev Oct 25, 2024
878300e
Update docs for _loops.py
vlad-perevezentsev Oct 25, 2024
ff6d2b3
Use .helper in cupy/testing/__init__.py
vlad-perevezentsev Oct 25, 2024
326276b
Use relative imports in cupy tests
vlad-perevezentsev Oct 25, 2024
66ad5d8
Add empty __init__.py files to cupy tests
vlad-perevezentsev Oct 25, 2024
a342e04
Update import path in test_add_remove.py
vlad-perevezentsev Oct 25, 2024
b80939c
Undo updating call pytest on gen_coverage.py
vlad-perevezentsev Oct 25, 2024
5380aff
Update tests-path for GH Actions
vlad-perevezentsev Oct 28, 2024
a0aba61
Merge master into move_tests_folder
vlad-perevezentsev Oct 28, 2024
4edbbd1
Show extra test summary info in internal CI
vlad-perevezentsev Oct 28, 2024
f410961
Fix normalize_test_name() to support subdirectories
vlad-perevezentsev Oct 28, 2024
6a1ffac
Remove debug lines in conftest.py
vlad-perevezentsev Oct 28, 2024
14e4111
Update normalize_test_name to run pytest from diff paths
vlad-perevezentsev Oct 29, 2024
b996d90
Add run_test.bat to conda-recipe
vlad-perevezentsev Oct 29, 2024
351f101
Fix setting tests_path for Windows in conda-package.yml
vlad-perevezentsev Oct 29, 2024
d5fb73f
Update ser tests_path for windows
vlad-perevezentsev Oct 29, 2024
1388816
Add debug info for test_windows
vlad-perevezentsev Oct 29, 2024
ea9f5fd
Debug info
vlad-perevezentsev Oct 29, 2024
2d6c1a8
Use sysconfig to detect tests_path on Windows
vlad-perevezentsev Oct 30, 2024
4d049e8
Use --rootdir for test_windows in public CI
vlad-perevezentsev Oct 30, 2024
cf22ee8
Update pre-commit settings to move tests folder
vlad-perevezentsev Oct 31, 2024
c2f55a6
Move tests to dpnp folder
vlad-perevezentsev Oct 31, 2024
6f87e4a
Use absolute import paths in cupy tests
vlad-perevezentsev Oct 31, 2024
c7d3811
Update tests path in pyproject.toml
vlad-perevezentsev Oct 31, 2024
bf57f31
Use package_data instead of data_files in setup.py to pack tests
vlad-perevezentsev Oct 31, 2024
8c8b86a
Update args for generate coverage
vlad-perevezentsev Oct 31, 2024
c89e134
Merge master into move_tests_folder
vlad-perevezentsev Nov 3, 2024
1cf7670
Update import path in test_arraypad.py
vlad-perevezentsev Nov 4, 2024
ca4d440
Add debug info for Public CI Win
vlad-perevezentsev Nov 4, 2024
1d44b35
Run only python 3.11 GH Actions
vlad-perevezentsev Nov 4, 2024
c1fe7c2
Use cd %tests_path%
vlad-perevezentsev Nov 4, 2024
76f610b
use pushd to move to tests folder
vlad-perevezentsev Nov 4, 2024
a73b121
Switch to C: drive for test_windows
vlad-perevezentsev Nov 4, 2024
7e253c9
Merge master into move_tests_folder
vlad-perevezentsev Nov 4, 2024
c33e3d3
Remove debug lines
vlad-perevezentsev Nov 4, 2024
26a4b4b
Merge master into move_tests_folder
vlad-perevezentsev Nov 4, 2024
2cdca1e
Rename TEST_SCOPE files to use pytest --pyargs
vlad-perevezentsev Nov 5, 2024
cac52d8
Run tests from test_tmp folder
vlad-perevezentsev Nov 5, 2024
80e7d72
Use --pyargs for tests in public CI
vlad-perevezentsev Nov 5, 2024
61b68ac
Run tests from {github.workspace} and use pytest for public CI
vlad-perevezentsev Nov 6, 2024
ac8ac50
Merge master into move_tests_folder
vlad-perevezentsev Nov 6, 2024
7e410c4
Run all tests by --pyargs dpnp.tests in public CI
vlad-perevezentsev Nov 6, 2024
f76a0e6
Merge master into move_tests_folder
vlad-perevezentsev Nov 7, 2024
0e29f02
Merge master into move_tests_folder
vlad-perevezentsev Nov 7, 2024
9ea9d06
Remove warning filter for pkg_resources
vlad-perevezentsev Nov 7, 2024
8088098
Remove unused imports in test files
vlad-perevezentsev Nov 7, 2024
93566f1
Align import for test_arraypad.py
vlad-perevezentsev Nov 7, 2024
e03cd93
Use absolute import path in cupy/testing
vlad-perevezentsev Nov 7, 2024
f1a023b
Print dpnp version while testing conda package
vlad-perevezentsev Nov 7, 2024
cab2f48
Disable verbose and disable-warnings pytest mode for public CI
vlad-perevezentsev Nov 7, 2024
a1c54cc
Disable quiet, verbose, disable-warnings pytest mode for testing cond…
vlad-perevezentsev Nov 7, 2024
83687e6
Merge master into move_tests_folder
vlad-perevezentsev Nov 7, 2024
f5a6031
Merge master into move_tests_folder
vlad-perevezentsev Nov 13, 2024
5274a5e
Merge master into move_tests_folder
vlad-perevezentsev Nov 14, 2024
af3205d
Merge master into move_tests_folder
vlad-perevezentsev Nov 14, 2024
ce95578
Merge master into move_tests_folder
vlad-perevezentsev Nov 14, 2024
004202f
Remove dublicate env variable MODULE_NAME in conda-package.yaml
vlad-perevezentsev Nov 14, 2024
8d0e646
Remove working-directory usage for Run tests in conda-package.yml
vlad-perevezentsev Nov 14, 2024
38a1472
Merge master into move_tests_folder
vlad-perevezentsev Nov 14, 2024
4c90c59
Merge master into move_tests_folder
vlad-perevezentsev Nov 14, 2024
05bd7fa
Merge master into move_tests_folder
vlad-perevezentsev Nov 15, 2024
6a0c2be
Merge master into move_tests_folder
vlad-perevezentsev Nov 15, 2024
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
94 changes: 47 additions & 47 deletions .github/workflows/conda-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,51 +20,51 @@ env:
RUN_TESTS_MAX_ATTEMPTS: 2
TEST_ENV_NAME: 'test'
TEST_SCOPE: >-
test_absolute.py
test_amin_amax.py
test_arithmetic.py
test_arraycreation.py
test_arraymanipulation.py
test_bitwise.py
test_copy.py
test_counting.py
test_fft.py
test_fill.py
test_flat.py
test_histogram.py
test_indexing.py
test_linalg.py
test_logic.py
test_manipulation.py
test_mathematical.py
test_mixins.py
test_nanfunctions.py
test_ndarray.py
test_outer.py
test_product.py
test_random_state.py
test_search.py
test_sort.py
test_special.py
test_statistics.py
test_sum.py
test_sycl_queue.py
test_umath.py
test_usm_type.py
third_party/cupy/core_tests
third_party/cupy/fft_tests
third_party/cupy/creation_tests
third_party/cupy/indexing_tests
third_party/cupy/lib_tests
third_party/cupy/linalg_tests
third_party/cupy/logic_tests
third_party/cupy/manipulation_tests
third_party/cupy/math_tests
third_party/cupy/sorting_tests
third_party/cupy/statistics_tests/test_histogram.py
third_party/cupy/statistics_tests/test_meanvar.py
third_party/cupy/test_ndim.py
third_party/cupy/test_type_routines.py
tests/test_absolute.py
tests/test_amin_amax.py
tests/test_arithmetic.py
tests/test_arraycreation.py
tests/test_arraymanipulation.py
tests/test_bitwise.py
tests/test_copy.py
tests/test_counting.py
tests/test_fft.py
tests/test_fill.py
tests/test_flat.py
tests/test_histogram.py
tests/test_indexing.py
tests/test_linalg.py
tests/test_logic.py
tests/test_manipulation.py
tests/test_mathematical.py
tests/test_mixins.py
tests/test_nanfunctions.py
tests/test_ndarray.py
tests/test_outer.py
tests/test_product.py
tests/test_random_state.py
tests/test_search.py
tests/test_sort.py
tests/test_special.py
tests/test_statistics.py
tests/test_sum.py
tests/test_sycl_queue.py
tests/test_umath.py
tests/test_usm_type.py
tests/third_party/cupy/core_tests
tests/third_party/cupy/fft_tests
tests/third_party/cupy/creation_tests
tests/third_party/cupy/indexing_tests
tests/third_party/cupy/lib_tests
tests/third_party/cupy/linalg_tests
tests/third_party/cupy/logic_tests
tests/third_party/cupy/manipulation_tests
tests/third_party/cupy/math_tests
tests/third_party/cupy/sorting_tests
tests/third_party/cupy/statistics_tests/test_histogram.py
tests/third_party/cupy/statistics_tests/test_meanvar.py
tests/third_party/cupy/test_ndim.py
tests/third_party/cupy/test_type_routines.py
VER_JSON_NAME: 'version.json'
VER_SCRIPT1: "import json; f = open('version.json', 'r'); j = json.load(f); f.close(); "
VER_SCRIPT2: "d = j['dpnp'][0]; print('='.join((d[s] for s in ('version', 'build'))))"
Expand Down Expand Up @@ -179,7 +179,7 @@ jobs:
channel-path: '${{ github.workspace }}/channel/'
pkg-path-in-channel: '${{ github.workspace }}/channel/linux-64/'
extracted-pkg-path: '${{ github.workspace }}/pkg/'
tests-path: '${{ github.workspace }}/pkg/info/test/tests/'
# tests-path: '${{ github.workspace }}/pkg/info/test/tests/'
ver-json-path: '${{ github.workspace }}/version.json'

steps:
Expand Down Expand Up @@ -260,7 +260,7 @@ jobs:
if: env.RERUN_TESTS_ON_FAILURE != 'true'
run: |
python -m pytest -q -ra --disable-warnings -vv ${{ env.TEST_SCOPE }}
working-directory: ${{ env.tests-path }}
# working-directory: ${{ env.tests-path }}

- name: Run tests
if: env.RERUN_TESTS_ON_FAILURE == 'true'
Expand Down
2 changes: 0 additions & 2 deletions MANIFEST.in

This file was deleted.

8 changes: 0 additions & 8 deletions conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,6 @@ test:
requires:
- pytest
- setuptools
source_files:
- examples
- tests
- setup.cfg
commands:
- python -c "import dpnp; print(dpnp.__version__)"
- python -m dpctl -f
- pytest -s

about:
home: https://github.com/IntelPython/dpnp
Expand Down
12 changes: 12 additions & 0 deletions conda-recipe/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,15 @@ if [ -n "${TBBROOT}" ]; then
# shellcheck source=/dev/null
. "${TBBROOT}"/env/vars.sh
fi

# If PYTHON is not set
# assign it to the Python interpreter from the testing environment
if [ -z "${PYTHON}" ]; then
PYTHON=$PREFIX/bin/python
fi

set -e

$PYTHON -c "import dpctl; print(dpctl.__version__)"
$PYTHON -m dpctl -f
$PYTHON -m pytest -q -ra --disable-warnings --pyargs dpnp
2 changes: 1 addition & 1 deletion scripts/gen_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def run(
"--cov-report",
"term-missing",
"--pyargs",
"tests",
"dpnp",
"-vv",
*pytest_opts.split(),
],
Expand Down
19 changes: 0 additions & 19 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,6 @@
max_line_length = 120
ignore = E201

[tool:pytest]
# By default, tests marked as slow will be deselected.
# To run all tests, use -m "slow and not slow".
# To run only slow tests, use -m "slow".
addopts = -m "not slow" --tb=short --strict-markers
norecursedirs = tests_perf
testpaths = tests
markers =
slow: marks tests as slow (deselect with '-m "not slow"')
multi_gpu: marks tests that require a specified number of GPUs
filterwarnings =
# pkg_resources
ignore:pkg_resources is deprecated as an API:DeprecationWarning
# NumPy arccosh
# Undefined behavior depends on the backend:
# NumPy with OpenBLAS for np.array[1.0] does not raise a warning
# while numpy with OneMKL raises RuntimeWarning
ignore:invalid value encountered in arccosh:RuntimeWarning

[versioneer]
VCS = git
versionfile_source = dpnp/_version.py
Expand Down
35 changes: 34 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,37 @@ def _get_cmdclass():
Operating System :: Unix
"""

EXCLUDED_DIRS = ["tests_perf"]


def find_tests_files():
files_by_destination = {}
for root, dirs, files in os.walk("tests"):
# Exclude specified directories
dirs[:] = [dir for dir in dirs if dir not in EXCLUDED_DIRS]

for file in files:
file_path = os.path.join(root, file)
# Get the path relative to `tests`` to keep folder structure
relative_path = os.path.relpath(file_path, "tests")
destination = os.path.join(
"dpnp/tests", os.path.dirname(relative_path)
)

# Add the file to the correct destination folder in the dictionary
if destination not in files_by_destination:
files_by_destination[destination] = []
files_by_destination[destination].append(file_path)

# Convert the dictionary to the format expected by data_files:
# [(destination_folder, [list_of_files])]
tests_files = [
(dest, files) for dest, files in files_by_destination.items()
]

return tests_files


setup(
name="dpnp",
version=__version__,
Expand All @@ -67,12 +98,14 @@ def _get_cmdclass():
"dpnp.linalg",
"dpnp.random",
],
data_files=find_tests_files(),
package_data={
"dpnp": [
"backend/include/*.hpp",
"libdpnp_backend_c.so",
"dpnp_backend_c.lib",
"dpnp_backend_c.dll",
]
},
include_package_data=True,
include_package_data=False,
)
2 changes: 1 addition & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import numpy

from tests import testing
from dpnp.tests import testing

numpy.testing.assert_allclose = testing.assert_allclose
numpy.testing.assert_array_equal = testing.assert_array_equal
Expand Down
72 changes: 66 additions & 6 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,62 @@ def get_excluded_tests(test_exclude_file):
if os.path.exists(test_exclude_file):
with open(test_exclude_file) as skip_names_file:
excluded_tests = skip_names_file.readlines()
return excluded_tests
# Remove whitespace and filter out empty lines
return [line.strip() for line in excluded_tests if line.strip()]


# Normalize the nodeid to a relative path starting
# from the "tests/" directory
def normalize_test_name(nodeid):
nodeid = nodeid.replace("\n", "").strip()

if "tests/" in nodeid:
nodeid = nodeid.split("tests/")[-1]

# Add the "tests/"" prefix to ensure the nodeid matches
# the paths in the skipped tests files.
normalized_nodeid = "tests/" + nodeid

return normalized_nodeid


def pytest_configure(config):
# By default, tests marked as slow will be deselected.
# To run all tests, use -m "slow or not slow".
# To run only slow tests, use -m "slow".
# Equivalent to addopts = -m "not slow"
if not config.getoption("markexpr"):
config.option.markexpr = "not slow"
# Equivalent to addopts = --tb=short
if not config.getoption("tbstyle"):
config.option.tbstyle = "short"
# Equivalent to addopts = --strict-markers
if not config.getoption("strict_markers"):
config.option.strict_markers = True

# Register pytest markers
config.addinivalue_line(
"markers", "slow: marks tests as slow (deselect with '-m \"not slow\"')"
)
config.addinivalue_line(
"markers",
"multi_gpu: marks tests that require a specified number of GPUs",
)

# Add warning filters
# pkg_resources
config.addinivalue_line(
"filterwarnings",
"ignore:pkg_resources is deprecated as an API:DeprecationWarning",
)
# NumPy arccosh
# Undefined behavior depends on the backend:
# NumPy with OpenBLAS for np.array[1.0] does not raise a warning
# while numpy with OneMKL raises RuntimeWarning
config.addinivalue_line(
"filterwarnings",
"ignore:invalid value encountered in arccosh:RuntimeWarning",
)


def pytest_collection_modifyitems(config, items):
Expand Down Expand Up @@ -85,16 +140,21 @@ def pytest_collection_modifyitems(config, items):
excluded_tests.extend(get_excluded_tests(test_exclude_file))

for item in items:
# some test name contains '\n' in the parameters
test_name = item.nodeid.replace("\n", "").strip()
test_name = normalize_test_name(item.nodeid)

for item_tbl in excluded_tests:
# remove end-of-line character
item_tbl_str = item_tbl.strip()
# exact match of the test name with items from excluded_list
if test_name == item_tbl_str:
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)


@pytest.fixture
def allow_fall_back_on_numpy(monkeypatch):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_arithmetic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import numpy

from tests.helper import has_support_aspect64
from tests.third_party.cupy import testing
from .helper import has_support_aspect64
from .third_party.cupy import testing


class TestArithmetic(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_arraycreation.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
)

import dpnp
from tests.third_party.cupy import testing

from .helper import (
assert_dtype_allclose,
get_all_dtypes,
has_support_aspect64,
)
from .third_party.cupy import testing


class TestTrace:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_arraymanipulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
)

import dpnp
from tests.third_party.cupy import testing

from .helper import get_all_dtypes, get_float_complex_dtypes
from .third_party.cupy import testing


class TestAtleast1d:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

import dpnp
from dpnp.dpnp_array import dpnp_array
from tests.third_party.cupy import testing

from .helper import get_all_dtypes, get_integer_dtypes, has_support_aspect64
from .third_party.cupy import testing


def _add_keepdims(func):
Expand Down
Loading
Loading