Skip to content

Commit e60a6ea

Browse files
Merge pull request #1834 from IntelPython/backport-gh-1833
Backport gh 1833
2 parents 19331c0 + 7ced676 commit e60a6ea

17 files changed

+51
-16
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ The full list of changes that went into this release are:
5757
* Avoid dead-locking by releasing GIL around blocking operations in libtensor [gh-1753](https://github.com/IntelPython/dpctl/pull/1753)
5858
* Element-wise `tensor.divide` and comparison operations allow greater range of Python integer and integer array combinations [gh-1771](https://github.com/IntelPython/dpctl/pull/1771)
5959
* Fix for unexpected behavior when using floating point types for array indexing [gh-1792](https://github.com/IntelPython/dpctl/pull/1792)
60+
* Enable `pytest --pyargs dpctl.tests` [gh-1833](https://github.com/IntelPython/dpctl/pull/1833)
6061

6162
### Maintenance
6263

dpctl/tests/__init__.py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Data Parallel Control (dpctl)
2+
#
3+
# Copyright 2020-2024 Intel Corporation
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
__doc__ = r"""
18+
Test suite of `dpctl`. Running test suite requires Cython,
19+
and a working compiler."""

dpctl/tests/conftest.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@
2121
import sys
2222

2323
import pytest
24-
from _device_attributes_checks import (
24+
25+
from ._device_attributes_checks import (
2526
check,
2627
device_selector,
2728
invalid_filter,
2829
valid_filter,
2930
)
30-
from _numpy_warnings import suppress_invalid_numpy_warnings
31+
from ._numpy_warnings import suppress_invalid_numpy_warnings
3132

3233
sys.path.append(os.path.join(os.path.dirname(__file__), "helper"))
3334

dpctl/tests/test_sycl_context.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@
1818
"""
1919

2020
import pytest
21-
from helper import create_invalid_capsule
2221

2322
import dpctl
2423

24+
from .helper import create_invalid_capsule
25+
2526
list_of_valid_filter_selectors = [
2627
"opencl",
2728
"opencl:gpu",

dpctl/tests/test_sycl_device.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@
1818
"""
1919

2020
import pytest
21-
from helper import get_queue_or_skip
2221

2322
import dpctl
2423
from dpctl import SyclDeviceCreationError
2524

25+
from .helper import get_queue_or_skip
26+
2627

2728
def test_standard_selectors(device_selector, check):
2829
"""Tests if the standard SYCL device_selectors are able to select a

dpctl/tests/test_sycl_event.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@
1818
"""
1919

2020
import pytest
21-
from helper import create_invalid_capsule
2221

2322
import dpctl
2423
import dpctl.memory as dpctl_mem
2524
import dpctl.program as dpctl_prog
2625
import dpctl.tensor as dpt
2726
from dpctl import event_status_type as esty
2827

28+
from .helper import create_invalid_capsule
29+
2930

3031
def produce_event(profiling=False):
3132
oclSrc = " \

dpctl/tests/test_sycl_platform.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@
2020
import sys
2121

2222
import pytest
23-
from helper import has_sycl_platforms
2423

2524
import dpctl
2625

26+
from .helper import has_sycl_platforms
27+
2728
list_of_valid_filter_selectors = [
2829
"opencl",
2930
"opencl:gpu",

dpctl/tests/test_sycl_queue.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@
2121
import sys
2222

2323
import pytest
24-
from helper import create_invalid_capsule
2524

2625
import dpctl
2726

27+
from .helper import create_invalid_capsule
28+
2829

2930
def test_standard_selectors(device_selector, check):
3031
"""

dpctl/tests/test_tensor_accumulation.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@
1717
from random import randrange
1818

1919
import pytest
20-
from helper import get_queue_or_skip, skip_if_dtype_not_supported
2120

2221
import dpctl.tensor as dpt
2322
from dpctl.utils import ExecutionPlacementError
2423

24+
from .helper import get_queue_or_skip, skip_if_dtype_not_supported
25+
2526
sint_types = [
2627
dpt.int8,
2728
dpt.int16,

dpctl/tests/test_tensor_asarray.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@
1616

1717
import numpy as np
1818
import pytest
19-
from helper import get_queue_or_skip
2019

2120
import dpctl
2221
import dpctl.tensor as dpt
2322

23+
from .helper import get_queue_or_skip
24+
2425

2526
@pytest.mark.parametrize(
2627
"src_usm_type, dst_usm_type",

dpctl/tests/test_tensor_clip.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
import numpy as np
1818
import pytest
19-
from helper import get_queue_or_skip, skip_if_dtype_not_supported
2019
from numpy.testing import assert_raises_regex
2120

2221
import dpctl
@@ -29,6 +28,8 @@
2928
)
3029
from dpctl.utils import ExecutionPlacementError
3130

31+
from .helper import get_queue_or_skip, skip_if_dtype_not_supported
32+
3233
_all_dtypes = [
3334
"?",
3435
"u1",

dpctl/tests/test_usm_ndarray_ctor.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@
2020

2121
import numpy as np
2222
import pytest
23-
from helper import get_queue_or_skip, skip_if_dtype_not_supported
2423

2524
import dpctl
2625
import dpctl.memory as dpm
2726
import dpctl.tensor as dpt
2827
from dpctl.tensor import Device
2928

29+
from .helper import get_queue_or_skip, skip_if_dtype_not_supported
30+
3031

3132
@pytest.mark.parametrize(
3233
"shape",

dpctl/tests/test_usm_ndarray_dlpack.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@
1919

2020
import numpy as np
2121
import pytest
22-
from helper import get_queue_or_skip, skip_if_dtype_not_supported
2322

2423
import dpctl
2524
import dpctl.tensor as dpt
2625
import dpctl.tensor._dlpack as _dlp
2726
import dpctl.tensor._usmarray as dpt_arr
2827

28+
from .helper import get_queue_or_skip, skip_if_dtype_not_supported
29+
2930
device_CPU = dpt_arr.DLDeviceType.kDLCPU
3031
device_oneAPI = dpt_arr.DLDeviceType.kDLOneAPI
3132

dpctl/tests/test_usm_ndarray_indexing.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,15 @@
1717

1818
import numpy as np
1919
import pytest
20-
from helper import get_queue_or_skip, skip_if_dtype_not_supported
2120
from numpy.testing import assert_array_equal
2221

2322
import dpctl
2423
import dpctl.tensor as dpt
2524
import dpctl.tensor._tensor_impl as ti
2625
from dpctl.utils import ExecutionPlacementError
2726

27+
from .helper import get_queue_or_skip, skip_if_dtype_not_supported
28+
2829
_all_dtypes = [
2930
"u1",
3031
"i1",

dpctl/tests/test_usm_ndarray_print.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@
1616

1717
import numpy as np
1818
import pytest
19-
from helper import get_queue_or_skip, skip_if_dtype_not_supported
2019

2120
import dpctl
2221
import dpctl.tensor as dpt
2322

23+
from .helper import get_queue_or_skip, skip_if_dtype_not_supported
24+
2425

2526
class TestPrint:
2627
def setup_method(self):

dpctl/tests/test_usm_ndarray_search_functions.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,15 @@
1919

2020
import numpy as np
2121
import pytest
22-
from helper import get_queue_or_skip, skip_if_dtype_not_supported
2322
from numpy.testing import assert_array_equal
2423

2524
import dpctl.tensor as dpt
2625
from dpctl.tensor._search_functions import _where_result_type
2726
from dpctl.tensor._type_utils import _all_data_types
2827
from dpctl.utils import ExecutionPlacementError
2928

29+
from .helper import get_queue_or_skip, skip_if_dtype_not_supported
30+
3031
_all_dtypes = [
3132
"?",
3233
"u1",

dpctl/tests/test_usm_ndarray_searchsorted.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import numpy as np
22
import pytest
3-
from helper import get_queue_or_skip, skip_if_dtype_not_supported
43

54
import dpctl
65
import dpctl.tensor as dpt
76
import dpctl.utils as dpu
87

8+
from .helper import get_queue_or_skip, skip_if_dtype_not_supported
9+
910

1011
def _check(hay_stack, needles, needles_np):
1112
assert hay_stack.dtype == needles.dtype

0 commit comments

Comments
 (0)