diff --git a/hls4ml/backends/oneapi/oneapi_backend.py b/hls4ml/backends/oneapi/oneapi_backend.py index a4000529c3..a1f5cec984 100644 --- a/hls4ml/backends/oneapi/oneapi_backend.py +++ b/hls4ml/backends/oneapi/oneapi_backend.py @@ -175,6 +175,15 @@ def compile(self, model): try: subprocess.run('which icpx', shell=True, cwd=builddir, check=True) except subprocess.CalledProcessError: + try: + import os + + if "PYTEST_CURRENT_TEST" in os.environ: + import pytest + + pytest.skip('icpx not present') + except ImportError: + pass raise RuntimeError('Could not find icpx. Please configure oneAPI appropriately') subprocess.run('cmake ..', shell=True, cwd=builddir, check=True) subprocess.run('make lib', shell=True, cwd=builddir, check=True) @@ -200,6 +209,15 @@ def build(self, model, build_type='fpga_emu', run=False): try: subprocess.run('which icpx', shell=True, cwd=builddir, check=True) except subprocess.CalledProcessError: + try: + import os + + if "PYTEST_CURRENT_TEST" in os.environ: + import pytest + + pytest.skip('icpx not present') + except ImportError: + pass raise RuntimeError('Could not find icpx. Please configure oneAPI appropriately') subprocess.run('cmake ..', shell=True, cwd=builddir, check=True) subprocess.run(f'make {build_type}', shell=True, cwd=builddir, check=True)