Skip to content

Commit fad5749

Browse files
Update imports in tensor tests and add conftest.py
1 parent 1a56ad0 commit fad5749

80 files changed

Lines changed: 369 additions & 259 deletions

File tree

Some content is hidden

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

dpctl_ext/tests/tensor/conftest.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# *****************************************************************************
2+
# Copyright (c) 2026, Intel Corporation
3+
# All rights reserved.
4+
#
5+
# Redistribution and use in source and binary forms, with or without
6+
# modification, are permitted provided that the following conditions are met:
7+
# - Redistributions of source code must retain the above copyright notice,
8+
# this list of conditions and the following disclaimer.
9+
# - Redistributions in binary form must reproduce the above copyright notice,
10+
# this list of conditions and the following disclaimer in the documentation
11+
# and/or other materials provided with the distribution.
12+
# - Neither the name of the copyright holder nor the names of its contributors
13+
# may be used to endorse or promote products derived from this software
14+
# without specific prior written permission.
15+
#
16+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
26+
# THE POSSIBILITY OF SUCH DAMAGE.
27+
# *****************************************************************************
28+
29+
"""Configures pytest to discover helper/ module"""
30+
31+
from dpnp.tests.conftest import suppress_invalid_numpy_warnings

dpctl_ext/tests/tensor/elementwise/test_abs.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,17 @@
3535
# TODO: revert to `import dpctl.tensor...`
3636
# when dpnp fully migrates dpctl/tensor
3737
import dpctl_ext.tensor as dpt
38-
from dpnp.tests.tensor.elementwise.utils import (
38+
39+
from ..helper import (
40+
get_queue_or_skip,
41+
skip_if_dtype_not_supported,
42+
)
43+
from .utils import (
3944
_all_dtypes,
4045
_complex_fp_dtypes,
4146
_real_fp_dtypes,
4247
_usm_types,
4348
)
44-
from dpnp.tests.tensor.helper import (
45-
get_queue_or_skip,
46-
skip_if_dtype_not_supported,
47-
)
4849

4950

5051
@pytest.mark.parametrize("dtype", _all_dtypes)

dpctl_ext/tests/tensor/elementwise/test_add.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,16 @@
3838
# when dpnp fully migrates dpctl/tensor
3939
import dpctl_ext.tensor as dpt
4040
from dpctl_ext.tensor._type_utils import _can_cast
41-
from dpnp.tests.tensor.elementwise.utils import (
41+
42+
from ..helper import (
43+
get_queue_or_skip,
44+
skip_if_dtype_not_supported,
45+
)
46+
from .utils import (
4247
_all_dtypes,
4348
_compare_dtypes,
4449
_usm_types,
4550
)
46-
from dpnp.tests.tensor.helper import (
47-
get_queue_or_skip,
48-
skip_if_dtype_not_supported,
49-
)
5051

5152

5253
@pytest.mark.parametrize("op1_dtype", _all_dtypes)

dpctl_ext/tests/tensor/elementwise/test_angle.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,16 @@
3535
# when dpnp fully migrates dpctl/tensor
3636
import dpctl_ext.tensor as dpt
3737
from dpctl_ext.tensor._type_utils import _can_cast
38-
from dpnp.tests.tensor.elementwise.utils import (
38+
39+
from ..helper import (
40+
get_queue_or_skip,
41+
skip_if_dtype_not_supported,
42+
)
43+
from .utils import (
3944
_all_dtypes,
4045
_complex_fp_dtypes,
4146
_no_complex_dtypes,
4247
)
43-
from dpnp.tests.tensor.helper import (
44-
get_queue_or_skip,
45-
skip_if_dtype_not_supported,
46-
)
4748

4849

4950
@pytest.mark.parametrize("dtype", _all_dtypes)

dpctl_ext/tests/tensor/elementwise/test_atan2.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,15 @@
3535
# TODO: revert to `import dpctl.tensor...`
3636
# when dpnp fully migrates dpctl/tensor
3737
import dpctl_ext.tensor as dpt
38-
from dpnp.tests.tensor.elementwise.utils import (
39-
_compare_dtypes,
40-
_no_complex_dtypes,
41-
)
42-
from dpnp.tests.tensor.helper import (
38+
39+
from ..helper import (
4340
get_queue_or_skip,
4441
skip_if_dtype_not_supported,
4542
)
43+
from .utils import (
44+
_compare_dtypes,
45+
_no_complex_dtypes,
46+
)
4647

4748

4849
@pytest.mark.parametrize("op1_dtype", _no_complex_dtypes[1:])

dpctl_ext/tests/tensor/elementwise/test_bitwise_and.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@
3333
# when dpnp fully migrates dpctl/tensor
3434
import dpctl_ext.tensor as dpt
3535
from dpctl_ext.tensor._type_utils import _can_cast
36-
from dpnp.tests.tensor.elementwise.utils import _integral_dtypes
37-
from dpnp.tests.tensor.helper import (
36+
37+
from ..helper import (
3838
get_queue_or_skip,
3939
skip_if_dtype_not_supported,
4040
)
41+
from .utils import _integral_dtypes
4142

4243

4344
@pytest.mark.parametrize("op_dtype", _integral_dtypes)

dpctl_ext/tests/tensor/elementwise/test_bitwise_invert.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,16 @@
3232
# TODO: revert to `import dpctl.tensor...`
3333
# when dpnp fully migrates dpctl/tensor
3434
import dpctl_ext.tensor as dpt
35-
from dpnp.tests.tensor.elementwise.utils import (
35+
36+
from ..helper import (
37+
get_queue_or_skip,
38+
skip_if_dtype_not_supported,
39+
)
40+
from .utils import (
3641
_compare_dtypes,
3742
_integral_dtypes,
3843
_usm_types,
3944
)
40-
from dpnp.tests.tensor.helper import (
41-
get_queue_or_skip,
42-
skip_if_dtype_not_supported,
43-
)
4445

4546

4647
@pytest.mark.parametrize(

dpctl_ext/tests/tensor/elementwise/test_bitwise_left_shift.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@
3333
# when dpnp fully migrates dpctl/tensor
3434
import dpctl_ext.tensor as dpt
3535
from dpctl_ext.tensor._type_utils import _can_cast
36-
from dpnp.tests.tensor.elementwise.utils import _integral_dtypes
37-
from dpnp.tests.tensor.helper import (
36+
37+
from ..helper import (
3838
get_queue_or_skip,
3939
skip_if_dtype_not_supported,
4040
)
41+
from .utils import _integral_dtypes
4142

4243

4344
@pytest.mark.parametrize("op1_dtype", _integral_dtypes)

dpctl_ext/tests/tensor/elementwise/test_bitwise_or.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@
3333
# when dpnp fully migrates dpctl/tensor
3434
import dpctl_ext.tensor as dpt
3535
from dpctl_ext.tensor._type_utils import _can_cast
36-
from dpnp.tests.tensor.elementwise.utils import _integral_dtypes
37-
from dpnp.tests.tensor.helper import (
36+
37+
from ..helper import (
3838
get_queue_or_skip,
3939
skip_if_dtype_not_supported,
4040
)
41+
from .utils import _integral_dtypes
4142

4243

4344
@pytest.mark.parametrize("op_dtype", _integral_dtypes)

dpctl_ext/tests/tensor/elementwise/test_bitwise_right_shift.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@
3333
# when dpnp fully migrates dpctl/tensor
3434
import dpctl_ext.tensor as dpt
3535
from dpctl_ext.tensor._type_utils import _can_cast
36-
from dpnp.tests.tensor.elementwise.utils import _integral_dtypes
37-
from dpnp.tests.tensor.helper import (
36+
37+
from ..helper import (
3838
get_queue_or_skip,
3939
skip_if_dtype_not_supported,
4040
)
41+
from .utils import _integral_dtypes
4142

4243

4344
@pytest.mark.parametrize("op1_dtype", _integral_dtypes)

0 commit comments

Comments
 (0)