Skip to content

Commit 02ab1eb

Browse files
A test for properties, method of q mirroring that of device
1 parent 149ed7a commit 02ab1eb

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

dpctl/tests/test_sycl_queue.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,28 @@ def test_hashing_of_queue():
391391
assert queue_dict
392392

393393

394+
def test_channeling_device_properties():
395+
try:
396+
q = dpctl.SyclQueue()
397+
dev = q.sycl_device
398+
except dpctl.SyclQueueCreationError:
399+
pytest.fail("Failed to create device from default selector")
400+
import io
401+
from contextlib import redirect_stdout
402+
403+
f1 = io.StringIO()
404+
with redirect_stdout(f1):
405+
q.print_device_info() # should execute without raising
406+
f2 = io.StringIO()
407+
with redirect_stdout(f2):
408+
dev.print_device_info()
409+
assert f1.getvalue() == f2.getvalue(), "Mismatch in print_device_info"
410+
for pr in ["backend", "name", "driver_version"]:
411+
assert getattr(q, pr) == getattr(
412+
dev, pr
413+
), "Mismatch found for property {}".format(pr)
414+
415+
394416
def test_queue_submit_barrier(valid_filter):
395417
try:
396418
q = dpctl.SyclQueue(valid_filter)

0 commit comments

Comments
 (0)