@@ -433,15 +433,15 @@ def test_queue_submit_barrier(valid_filter):
433433
434434
435435def test_queue__repr__ ():
436- q1 = dpctl .SyclQueue ()
436+ q1 = dpctl .SyclQueue (property = 0 )
437437 r1 = q1 .__repr__ ()
438438 q2 = dpctl .SyclQueue (property = "in_order" )
439439 r2 = q2 .__repr__ ()
440440 q3 = dpctl .SyclQueue (property = "enable_profiling" )
441441 r3 = q3 .__repr__ ()
442442 q4 = dpctl .SyclQueue (property = "default" )
443443 r4 = q4 .__repr__ ()
444- q5 = dpctl .SyclQueue (property = ["in_order" , "enable_profiling" ])
444+ q5 = dpctl .SyclQueue (property = ["in_order" , "enable_profiling" , 0 ])
445445 r5 = q5 .__repr__ ()
446446 assert type (r1 ) is str
447447 assert type (r2 ) is str
@@ -552,3 +552,45 @@ def test_queue_memops():
552552 q .prefetch (list (), 512 )
553553 with pytest .raises (TypeError ):
554554 q .mem_advise (list (), 512 , 0 )
555+
556+
557+ @pytest .fixture (scope = "session" )
558+ def dpctl_cython_extension (tmp_path_factory ):
559+ import os .path
560+ import shutil
561+ import subprocess
562+ import sys
563+ import sysconfig
564+
565+ curr_dir = os .path .dirname (__file__ )
566+ dr = tmp_path_factory .mktemp ("_cython_api" )
567+ for fn in ["_cython_api.pyx" , "setup_cython_api.py" ]:
568+ shutil .copy (
569+ src = os .path .join (curr_dir , fn ),
570+ dst = dr ,
571+ follow_symlinks = False ,
572+ )
573+ res = subprocess .run (
574+ [sys .executable , "setup_cython_api.py" , "build_ext" , "--inplace" ],
575+ cwd = dr ,
576+ )
577+ if res .returncode == 0 :
578+ import glob
579+ from importlib .util import module_from_spec , spec_from_file_location
580+
581+ sfx = sysconfig .get_config_vars ()["EXT_SUFFIX" ]
582+ pth = glob .glob (os .path .join (dr , "_cython_api*" + sfx ))
583+ if not pth :
584+ pytest .skip ("Cython extension was not built" )
585+ spec = spec_from_file_location ("_cython_api" , pth [0 ])
586+ builder_module = module_from_spec (spec )
587+ spec .loader .exec_module (builder_module )
588+ return builder_module
589+ else :
590+ pytest .skip ("Cython extension could not be built" )
591+
592+
593+ def test_cython_api (dpctl_cython_extension ):
594+ q = dpctl_cython_extension .call_create_from_context_and_devices ()
595+ d = dpctl .SyclDevice ()
596+ assert q .sycl_device == d
0 commit comments