Skip to content

Commit f036aef

Browse files
author
abergeron
authored
Merge pull request #571 from jvesely/cuda_test
pygpu/tests: Skip tests that require CUDA context if the context is not CUDA
2 parents 5761af1 + 0c25f2c commit f036aef

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pygpu/tests/test_gpu_ndarray.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def asfortranarray(shp, dtype, offseted_outer, offseted_inner, sliced, order):
195195

196196
# numpy upcast with a view to 1d scalar.
197197
if gpu.flags['F_CONTIGUOUS']:
198-
assert b.gpudata == gpu.gpudata
198+
assert ctx.kind != b'cuda' or b.gpudata == gpu.gpudata
199199
elif (sliced != 1 or shp == () or (offseted_outer and len(shp) > 1) or
200200
(order != 'f' and len(shp) > 1)):
201201
assert b is not gpu
@@ -286,7 +286,8 @@ def test_mapping_getitem_ellipsis():
286286
def mapping_getitem_ellipsis(shp, dtype, offseted):
287287
a, a_gpu = gen_gpuarray(shp, dtype, offseted, ctx=ctx)
288288
b = a_gpu[...]
289-
assert b.gpudata == a_gpu.gpudata
289+
if ctx.kind == b'cuda':
290+
assert b.gpudata == a_gpu.gpudata
290291
assert b.strides == a.strides
291292
assert b.shape == a.shape
292293
b_cpu = numpy.asarray(b)

0 commit comments

Comments
 (0)