Skip to content

Commit 7690952

Browse files
Merge pull request #973 from IntelPython/chore-cython-extension-build-error-fails-test
Error building Cython test extension must fail the tests, not skip it
2 parents 21a6931 + 0fb3550 commit 7690952

File tree

4 files changed

+25
-6
lines changed

4 files changed

+25
-6
lines changed

.github/workflows/conda-package.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,10 @@ jobs:
150150
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
151151
- name: Install dpctl
152152
run: |
153-
CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
153+
export CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
154+
export TEST_DEPENDENCIES="pytest pytest-cov cython"
154155
export PACKAGE_VERSION=$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")
155-
conda create -n test_dpctl $PACKAGE_NAME=${PACKAGE_VERSION} pytest python=${{ matrix.python }} $CHANNELS
156+
conda create -n test_dpctl $PACKAGE_NAME=${PACKAGE_VERSION} ${TEST_DEPENDENCIES} python=${{ matrix.python }} ${CHANNELS}
156157
# Test installed packages
157158
conda list -n test_dpctl
158159
- name: Smoke test
@@ -249,7 +250,8 @@ jobs:
249250
FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "%SCRIPT%"`) DO (
250251
SET PACKAGE_VERSION=%%F
251252
)
252-
conda install ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% pytest python=${{ matrix.python }} -c ${{ env.workdir }}/channel ${{ env.CHANNELS }}
253+
SET "TEST_DEPENDENCIES=pytest pytest-cov cython"
254+
conda install ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% %TEST_DEPENDENCIES% python=${{ matrix.python }} -c ${{ env.workdir }}/channel ${{ env.CHANNELS }}
253255
- name: Report content of test environemtn
254256
shell: cmd /C CALL {0}
255257
run: |

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [dev]
8+
9+
### Added
10+
11+
### Changed
12+
13+
### Fixed
14+
15+
716
## [0.14.0] - 11/18/2022
817

918
### Added

dpctl/tests/setup_cython_api.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17+
import Cython.Build
1718
import setuptools
1819

1920
import dpctl
@@ -25,4 +26,9 @@
2526
language="c++",
2627
)
2728

28-
setuptools.setup(name="_cython_api", version="0.0.0", ext_modules=[ext])
29+
setuptools.setup(
30+
name="_cython_api",
31+
version="0.0.0",
32+
ext_modules=[ext],
33+
cmdclass={"build_ext": Cython.Build.build_ext},
34+
)

dpctl/tests/test_sycl_queue.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ def test_queue_memops():
325325

326326
@pytest.fixture(scope="session")
327327
def dpctl_cython_extension(tmp_path_factory):
328+
import os
328329
import os.path
329330
import shutil
330331
import subprocess
@@ -342,6 +343,7 @@ def dpctl_cython_extension(tmp_path_factory):
342343
res = subprocess.run(
343344
[sys.executable, "setup_cython_api.py", "build_ext", "--inplace"],
344345
cwd=dr,
346+
env=os.environ,
345347
)
346348
if res.returncode == 0:
347349
import glob
@@ -350,13 +352,13 @@ def dpctl_cython_extension(tmp_path_factory):
350352
sfx = sysconfig.get_config_vars()["EXT_SUFFIX"]
351353
pth = glob.glob(os.path.join(dr, "_cython_api*" + sfx))
352354
if not pth:
353-
pytest.skip("Cython extension was not built")
355+
pytest.fail("Cython extension was not built")
354356
spec = spec_from_file_location("_cython_api", pth[0])
355357
builder_module = module_from_spec(spec)
356358
spec.loader.exec_module(builder_module)
357359
return builder_module
358360
else:
359-
pytest.skip("Cython extension could not be built")
361+
pytest.fail("Cython extension could not be built")
360362

361363

362364
def test_cython_api(dpctl_cython_extension):

0 commit comments

Comments
 (0)