@@ -47,7 +47,7 @@ def test_current_device(check):
47
47
try :
48
48
q = dpctl .get_current_queue ()
49
49
except Exception :
50
- pytest .fail ("Encountered an exception inside get_current_queue()." )
50
+ pytest .skip ("Encountered an exception inside get_current_queue()." )
51
51
device = q .get_sycl_device ()
52
52
check (device )
53
53
@@ -125,7 +125,7 @@ def test_has_enable_profiling():
125
125
try :
126
126
q = dpctl .SyclQueue (property = "enable_profiling" )
127
127
except dpctl .SyclQueueCreationError :
128
- pytest .skip ()
128
+ pytest .skip ("Could not create queue with profiling property enabled" )
129
129
assert q .has_enable_profiling
130
130
131
131
@@ -135,7 +135,11 @@ def test_hashing_of_queue():
135
135
a dictionary key.
136
136
137
137
"""
138
- queue_dict = {dpctl .SyclQueue (): "default_queue" }
138
+ try :
139
+ q = dpctl .SyclQueue ()
140
+ except dpctl .SyclQueueCreationError :
141
+ pytest .skip ("Default-constructed queue could not be created" )
142
+ queue_dict = {q : "default_queue" }
139
143
assert queue_dict
140
144
141
145
@@ -144,7 +148,7 @@ def test_channeling_device_properties(capsys):
144
148
q = dpctl .SyclQueue ()
145
149
dev = q .sycl_device
146
150
except dpctl .SyclQueueCreationError :
147
- pytest .fail ("Failed to create device from default selector" )
151
+ pytest .skip ("Failed to create device from default selector" )
148
152
149
153
q .print_device_info () # should execute without raising
150
154
q_captured = capsys .readouterr ()
@@ -177,20 +181,39 @@ def test_queue_submit_barrier(valid_filter):
177
181
178
182
179
183
def test_queue__repr__ ():
180
- q1 = dpctl .SyclQueue (property = 0 )
184
+ try :
185
+ q1 = dpctl .SyclQueue (property = 0 )
186
+ except dpctl .SyclQueueCreationError :
187
+ pytest .skip ()
181
188
r1 = q1 .__repr__ ()
182
- q2 = dpctl .SyclQueue (property = "in_order" )
183
- r2 = q2 .__repr__ ()
184
- q3 = dpctl .SyclQueue (property = "enable_profiling" )
185
- r3 = q3 .__repr__ ()
186
- q4 = dpctl .SyclQueue (property = "default" )
187
- r4 = q4 .__repr__ ()
188
- q5 = dpctl .SyclQueue (property = ["in_order" , "enable_profiling" , 0 ])
189
- r5 = q5 .__repr__ ()
190
189
assert type (r1 ) is str
190
+
191
+ try :
192
+ q2 = dpctl .SyclQueue (property = "in_order" )
193
+ except dpctl .SyclQueueCreationError :
194
+ pytest .skip ()
195
+ r2 = q2 .__repr__ ()
191
196
assert type (r2 ) is str
197
+
198
+ try :
199
+ q3 = dpctl .SyclQueue (property = "enable_profiling" )
200
+ except dpctl .SyclQueueCreationError :
201
+ pytest .skip ()
202
+ r3 = q3 .__repr__ ()
192
203
assert type (r3 ) is str
204
+
205
+ try :
206
+ q4 = dpctl .SyclQueue (property = "default" )
207
+ except dpctl .SyclQueueCreationError :
208
+ pytest .skip ()
209
+ r4 = q4 .__repr__ ()
193
210
assert type (r4 ) is str
211
+
212
+ try :
213
+ q5 = dpctl .SyclQueue (property = ["in_order" , "enable_profiling" , 0 ])
214
+ except dpctl .SyclQueueCreationError :
215
+ pytest .skip ()
216
+ r5 = q5 .__repr__ ()
194
217
assert type (r5 ) is str
195
218
196
219
@@ -202,7 +225,10 @@ def test_queue_invalid_property():
202
225
203
226
204
227
def test_queue_capsule ():
205
- q = dpctl .SyclQueue ()
228
+ try :
229
+ q = dpctl .SyclQueue ()
230
+ except dpctl .SyclQueueCreationError :
231
+ pytest .skip ("Can not defaul-construct SyclQueue" )
206
232
cap = q ._get_capsule ()
207
233
cap2 = q ._get_capsule ()
208
234
q2 = dpctl .SyclQueue (cap )
@@ -227,7 +253,10 @@ def test_queue_ctor():
227
253
228
254
229
255
def test_cpython_api_SyclQueue_GetQueueRef ():
230
- q = dpctl .SyclQueue ()
256
+ try :
257
+ q = dpctl .SyclQueue ()
258
+ except dpctl .SyclQueueCreationError :
259
+ pytest .skip ("Can not defaul-construct SyclQueue" )
231
260
mod = sys .modules [q .__class__ .__module__ ]
232
261
# get capsule storign SyclQueue_GetQueueRef function ptr
233
262
q_ref_fn_cap = mod .__pyx_capi__ ["SyclQueue_GetQueueRef" ]
@@ -247,7 +276,10 @@ def test_cpython_api_SyclQueue_GetQueueRef():
247
276
248
277
249
278
def test_cpython_api_SyclQueue_Make ():
250
- q = dpctl .SyclQueue ()
279
+ try :
280
+ q = dpctl .SyclQueue ()
281
+ except dpctl .SyclQueueCreationError :
282
+ pytest .skip ("Can not defaul-construct SyclQueue" )
251
283
mod = sys .modules [q .__class__ .__module__ ]
252
284
# get capsule storing SyclQueue_Make function ptr
253
285
make_SyclQueue_fn_cap = mod .__pyx_capi__ ["SyclQueue_Make" ]
@@ -271,7 +303,10 @@ def test_constructor_many_arg():
271
303
dpctl .SyclQueue (None , None , None , None )
272
304
with pytest .raises (TypeError ):
273
305
dpctl .SyclQueue (None , None )
274
- ctx = dpctl .SyclContext ()
306
+ try :
307
+ ctx = dpctl .SyclContext ()
308
+ except dpctl .SyclContextCreationError :
309
+ pytest .skip ()
275
310
with pytest .raises (TypeError ):
276
311
dpctl .SyclQueue (ctx , None )
277
312
with pytest .raises (TypeError ):
@@ -370,6 +405,12 @@ def dpctl_cython_extension(tmp_path_factory):
370
405
371
406
372
407
def test_cython_api (dpctl_cython_extension ):
373
- q = dpctl_cython_extension .call_create_from_context_and_devices ()
374
- d = dpctl .SyclDevice ()
408
+ try :
409
+ q = dpctl_cython_extension .call_create_from_context_and_devices ()
410
+ except (dpctl .SyclDeviceCreationError , dpctl .SyclQueueCreationError ):
411
+ pytest .skip ()
412
+ try :
413
+ d = dpctl .SyclDevice ()
414
+ except dpctl .SyclDeviceCreationError :
415
+ pytest .skip ("Default-construction of SyclDevice failed" )
375
416
assert q .sycl_device == d
0 commit comments