Skip to content

Commit

Permalink
Try to fix loading of Cython extension _cython_api on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
oleksandr-pavlyk committed Sep 9, 2021
1 parent 375560e commit c975c70
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions dpctl/tests/test_sycl_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,12 +575,14 @@ def dpctl_cython_extension(tmp_path_factory):
cwd=dr,
)
if res.returncode == 0:
import glob
from importlib.util import module_from_spec, spec_from_file_location

sfx = sysconfig.get_config_vars()["EXT_SUFFIX"]
spec = spec_from_file_location(
"_cython_api", os.path.join(dr, "_cython_api" + sfx)
)
pth = glob.glob(os.path.join(dr, "_cython_api*" + sfx))
if not pth:
pytest.skip("Cython extension was not built")
spec = spec_from_file_location("_cython_api", pth[0])
builder_module = module_from_spec(spec)
spec.loader.exec_module(builder_module)
return builder_module
Expand Down

0 comments on commit c975c70

Please sign in to comment.