Skip to content

Commit b050e8c

Browse files
Merge pull request #1172 from IntelPython/fix-tests-for-py3.11
Fix tests for py3.11
2 parents 456f46f + b8e2890 commit b050e8c

File tree

3 files changed

+24
-11
lines changed

3 files changed

+24
-11
lines changed

.github/workflows/generate-coverage.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111

1212
env:
1313
ONEAPI_ROOT: /opt/intel/oneapi
14-
GTEST_ROOT: /home/runner/work/googletest-release-1.11.0/install
14+
GTEST_ROOT: /home/runner/work/googletest-1.13.0/install
1515

1616
steps:
1717
- name: Cancel Previous Runs
@@ -39,16 +39,16 @@ jobs:
3939
- name: Setup Python
4040
uses: actions/setup-python@v4
4141
with:
42-
python-version: '3.10'
42+
python-version: '3.11'
4343
architecture: x64
4444

4545
- name: Cache Gtest
4646
id: cache-gtest
4747
uses: actions/cache@v3
4848
with:
4949
path: |
50-
/home/runner/work/googletest-release-1.11.0/install
51-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('/home/runner/work/googletest-release-1.11.0/install/include/gtest/*') }}
50+
/home/runner/work/googletest-1.13.0/install
51+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('/home/runner/work/googletest-1.13.0/install/include/gtest/*') }}
5252
restore-keys: |
5353
${{ runner.os }}-build-${{ env.cache-name }}-
5454
${{ runner.os }}-build-
@@ -59,12 +59,12 @@ jobs:
5959
shell: bash -l {0}
6060
run: |
6161
cd /home/runner/work
62-
wget https://github.com/google/googletest/archive/refs/tags/release-1.11.0.tar.gz
63-
tar xf release-1.11.0.tar.gz
64-
cd googletest-release-1.11.0
62+
wget https://github.com/google/googletest/archive/refs/tags/v1.13.0.tar.gz
63+
tar xf v1.13.0.tar.gz
64+
cd googletest-1.13.0
6565
mkdir build
6666
cd build
67-
cmake .. -DCMAKE_INSTALL_PREFIX=/home/runner/work/googletest-release-1.11.0/install
67+
cmake .. -DCMAKE_INSTALL_PREFIX=/home/runner/work/googletest-1.13.0/install
6868
make && make install
6969
7070
- name: Checkout repo

dpctl/tensor/_ctors.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -785,6 +785,12 @@ def _get_arange_length(start, stop, step):
785785
return _round_for_arange(tmp)
786786

787787

788+
def _to_scalar(obj, sc_ty):
789+
"A way to convert object to NumPy scalar type"
790+
zd_arr = np.asarray(obj).astype(sc_ty, casting="unsafe")
791+
return zd_arr[tuple()]
792+
793+
788794
def arange(
789795
start,
790796
/,
@@ -861,9 +867,9 @@ def arange(
861867
buffer_ctor_kwargs={"queue": sycl_queue},
862868
)
863869
sc_ty = dt.type
864-
_first = sc_ty(start)
870+
_first = _to_scalar(start, sc_ty)
865871
if sh > 1:
866-
_second = sc_ty(start + step)
872+
_second = _to_scalar(start + step, sc_ty)
867873
if dt in [dpt.uint8, dpt.uint16, dpt.uint32, dpt.uint64]:
868874
int64_ty = dpt.int64.type
869875
_step = int64_ty(_second) - int64_ty(_first)

dpctl/tests/test_sycl_queue_manager.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"""
1919

2020
import contextlib
21+
import sys
2122

2223
import pytest
2324
from helper import has_cpu, has_gpu, has_sycl_platforms
@@ -216,7 +217,13 @@ def factory(_):
216217
"factory, exception, match",
217218
[
218219
(True, TypeError, "object is not callable"),
219-
(lambda x: None, AttributeError, "no attribute '__exit__'"),
220+
(lambda x: None, AttributeError, "no attribute '__exit__'")
221+
if sys.version_info < (3, 11)
222+
else (
223+
lambda x: None,
224+
TypeError,
225+
r".* object does not support the context manager protocol",
226+
),
220227
],
221228
)
222229
def test_nested_context_factory_exception_if_wrong_factory(

0 commit comments

Comments
 (0)