18
18
import pytest
19
19
from helper import get_queue_or_skip , skip_if_dtype_not_supported
20
20
21
+ import dpctl
21
22
import dpctl .tensor as dpt
22
23
23
24
@@ -53,7 +54,10 @@ def test_usm_ndarray_repr_arg_validation(self):
53
54
with pytest .raises (TypeError ):
54
55
dpt .usm_ndarray_repr (X )
55
56
56
- X = dpt .arange (4 )
57
+ try :
58
+ X = dpt .arange (4 )
59
+ except dpctl .SyclDeviceCreationError :
60
+ pytest .skip ("No SYCL devices available" )
57
61
with pytest .raises (TypeError ):
58
62
dpt .usm_ndarray_repr (X , line_width = "I" )
59
63
@@ -68,7 +72,11 @@ def test_usm_ndarray_str_arg_validation(self):
68
72
with pytest .raises (TypeError ):
69
73
dpt .usm_ndarray_str (X )
70
74
71
- X = dpt .arange (4 )
75
+ try :
76
+ X = dpt .arange (4 )
77
+ except dpctl .SyclDeviceCreationError :
78
+ pytest .skip ("No SYCL devices available" )
79
+
72
80
with pytest .raises (TypeError ):
73
81
dpt .usm_ndarray_str (X , line_width = "I" )
74
82
@@ -363,8 +371,12 @@ def test_usm_ndarray_repr_prefix(self):
363
371
class TestContextManager :
364
372
def test_context_manager_basic (self ):
365
373
options = dpt .get_print_options ()
374
+ try :
375
+ X = dpt .asarray (1.234567 )
376
+ except dpctl .SyclDeviceCreationError :
377
+ pytest .skip ("No SYCL devices available" )
366
378
with dpt .print_options (precision = 4 ):
367
- s = str (dpt . asarray ( 1.234567 ) )
379
+ s = str (X )
368
380
assert s == "1.2346"
369
381
assert options == dpt .get_print_options ()
370
382
0 commit comments