Skip to content

Commit 662e519

Browse files
Modified tests to accept SyclDeviceCreationError rather than ValueError
1 parent b20509e commit 662e519

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

dpctl/tests/test_sycl_context.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def test_context_can_be_used_in_queue(valid_filter):
129129
def test_context_can_be_used_in_queue2(valid_filter):
130130
try:
131131
d = dpctl.SyclDevice(valid_filter)
132-
except dpctl.SyclContextCreationError:
132+
except dpctl.SyclDeviceCreationError:
133133
pytest.skip()
134134
if d.default_selector_score < 0:
135135
# skip test for devices rejected by default selector
@@ -141,7 +141,7 @@ def test_context_can_be_used_in_queue2(valid_filter):
141141
def test_context_multi_device():
142142
try:
143143
d = dpctl.SyclDevice("cpu")
144-
except dpctl.SyclContextCreationError:
144+
except dpctl.SyclDeviceCreationError:
145145
pytest.skip()
146146
if d.default_selector_score < 0:
147147
pytest.skip()

dpctl/tests/test_sycl_device.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ def test_standard_selectors(device_selector, check):
582582
try:
583583
device = device_selector()
584584
check(device)
585-
except ValueError:
585+
except dpctl.SyclDeviceCreationError:
586586
pytest.skip()
587587

588588

@@ -604,7 +604,7 @@ def test_valid_filter_selectors(valid_filter, check):
604604
device = None
605605
try:
606606
device = dpctl.SyclDevice(valid_filter)
607-
except ValueError:
607+
except SyclDeviceCreationError:
608608
pytest.skip("Failed to create device with supported filter")
609609
check(device)
610610

@@ -629,7 +629,7 @@ def test_filter_string(valid_filter):
629629
device = None
630630
try:
631631
device = dpctl.SyclDevice(valid_filter)
632-
except ValueError:
632+
except SyclDeviceCreationError:
633633
pytest.skip("Failed to create device with supported filter")
634634
dev_id = device.filter_string
635635
assert (
@@ -722,7 +722,7 @@ def unsupported_aspect(request):
722722
def test_supported_aspect(supported_aspect):
723723
try:
724724
dpctl.select_device_with_aspects(supported_aspect)
725-
except ValueError:
725+
except dpctl.SyclDeviceCreationError:
726726
# ValueError may be raised if no device with
727727
# requested aspect charateristics is available
728728
pass
@@ -741,9 +741,9 @@ def test_unsupported_aspect(unsupported_aspect):
741741

742742

743743
def test_handle_no_device():
744-
with pytest.raises(ValueError):
744+
with pytest.raises(dpctl.SyclDeviceCreationError):
745745
dpctl.select_device_with_aspects(["gpu", "cpu"])
746-
with pytest.raises(ValueError):
746+
with pytest.raises(dpctl.SyclDeviceCreationError):
747747
dpctl.select_device_with_aspects("cpu", excluded_aspects="cpu")
748748

749749

dpctl/tests/test_sycl_queue.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ def test_standard_selectors(device_selector, check):
307307
pytest.skip()
308308
q = dpctl.SyclQueue(device)
309309
check(q.get_sycl_device())
310-
except ValueError:
310+
except dpctl.SyclDeviceCreationError:
311311
pytest.skip()
312312

313313

0 commit comments

Comments
 (0)