Skip to content

Commit c975c70

Browse files
Try to fix loading of Cython extension _cython_api on Windows
1 parent 375560e commit c975c70

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

dpctl/tests/test_sycl_queue.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -575,12 +575,14 @@ def dpctl_cython_extension(tmp_path_factory):
575575
cwd=dr,
576576
)
577577
if res.returncode == 0:
578+
import glob
578579
from importlib.util import module_from_spec, spec_from_file_location
579580

580581
sfx = sysconfig.get_config_vars()["EXT_SUFFIX"]
581-
spec = spec_from_file_location(
582-
"_cython_api", os.path.join(dr, "_cython_api" + sfx)
583-
)
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])
584586
builder_module = module_from_spec(spec)
585587
spec.loader.exec_module(builder_module)
586588
return builder_module

0 commit comments

Comments
 (0)