Skip to content

Commit

Permalink
Merge pull request #973 from IntelPython/chore-cython-extension-build…
Browse files Browse the repository at this point in the history
…-error-fails-test

Error building Cython test extension must fail the tests, not skip it
  • Loading branch information
oleksandr-pavlyk authored Nov 19, 2022
2 parents 21a6931 + 0fb3550 commit 7690952
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/conda-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,10 @@ jobs:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
- name: Install dpctl
run: |
CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
export CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
export TEST_DEPENDENCIES="pytest pytest-cov cython"
export PACKAGE_VERSION=$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")
conda create -n test_dpctl $PACKAGE_NAME=${PACKAGE_VERSION} pytest python=${{ matrix.python }} $CHANNELS
conda create -n test_dpctl $PACKAGE_NAME=${PACKAGE_VERSION} ${TEST_DEPENDENCIES} python=${{ matrix.python }} ${CHANNELS}
# Test installed packages
conda list -n test_dpctl
- name: Smoke test
Expand Down Expand Up @@ -249,7 +250,8 @@ jobs:
FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "%SCRIPT%"`) DO (
SET PACKAGE_VERSION=%%F
)
conda install ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% pytest python=${{ matrix.python }} -c ${{ env.workdir }}/channel ${{ env.CHANNELS }}
SET "TEST_DEPENDENCIES=pytest pytest-cov cython"
conda install ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% %TEST_DEPENDENCIES% python=${{ matrix.python }} -c ${{ env.workdir }}/channel ${{ env.CHANNELS }}
- name: Report content of test environemtn
shell: cmd /C CALL {0}
run: |
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [dev]

### Added

### Changed

### Fixed


## [0.14.0] - 11/18/2022

### Added
Expand Down
8 changes: 7 additions & 1 deletion dpctl/tests/setup_cython_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import Cython.Build
import setuptools

import dpctl
Expand All @@ -25,4 +26,9 @@
language="c++",
)

setuptools.setup(name="_cython_api", version="0.0.0", ext_modules=[ext])
setuptools.setup(
name="_cython_api",
version="0.0.0",
ext_modules=[ext],
cmdclass={"build_ext": Cython.Build.build_ext},
)
6 changes: 4 additions & 2 deletions dpctl/tests/test_sycl_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ def test_queue_memops():

@pytest.fixture(scope="session")
def dpctl_cython_extension(tmp_path_factory):
import os
import os.path
import shutil
import subprocess
Expand All @@ -342,6 +343,7 @@ def dpctl_cython_extension(tmp_path_factory):
res = subprocess.run(
[sys.executable, "setup_cython_api.py", "build_ext", "--inplace"],
cwd=dr,
env=os.environ,
)
if res.returncode == 0:
import glob
Expand All @@ -350,13 +352,13 @@ def dpctl_cython_extension(tmp_path_factory):
sfx = sysconfig.get_config_vars()["EXT_SUFFIX"]
pth = glob.glob(os.path.join(dr, "_cython_api*" + sfx))
if not pth:
pytest.skip("Cython extension was not built")
pytest.fail("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
else:
pytest.skip("Cython extension could not be built")
pytest.fail("Cython extension could not be built")


def test_cython_api(dpctl_cython_extension):
Expand Down

0 comments on commit 7690952

Please sign in to comment.