Skip to content

Commit

Permalink
Add Python tests (1) (#11)
Browse files Browse the repository at this point in the history
* bindings created

* pip install . working

* python -m build working (on Windows anyway)

* get it building on linux

* Remove test stub (save for the next PR)

* Undo an overzealous rename

* Add Python wheel build job

* Prepare for Python bindings

* Don't export the enum values into the module base namespace.

* (wip) some basic tests

* Revert CMake minimum version and use cmake_policy. Using builtin `BUILD_TESTING` cmake option.

* Update build.yml

* Update release.yml

* some simple tests

* add python tests to CI
  • Loading branch information
aliddell authored Oct 14, 2024
1 parent c1cb57b commit 7d6dd61
Show file tree
Hide file tree
Showing 5 changed files with 452 additions and 66 deletions.
54 changes: 48 additions & 6 deletions .github/workflows/test_pr.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,6 @@ jobs:
submodules: true
ref: ${{ github.event.pull_request.head.sha }}

- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install minio and mcli
run: |
apt update && apt install -y tmux wget
Expand Down Expand Up @@ -137,4 +132,51 @@ jobs:
ZARR_S3_BUCKET_NAME: ${{ env.MINIO_BUCKET }}
ZARR_S3_ACCESS_KEY_ID: ${{ env.MINIO_ACCESS_KEY }}
ZARR_S3_SECRET_ACCESS_KEY: ${{ env.MINIO_SECRET_KEY }}
run: ctest -C ${{env.BUILD_TYPE}} -L s3 --output-on-failure
run: ctest -C ${{env.BUILD_TYPE}} -L s3 --output-on-failure

test_python:
name: Test on ${{ matrix.platform }}
runs-on: ${{ matrix.platform }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
platform:
- "ubuntu-latest"
- "windows-latest"
- "macos-latest"

steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

- uses: actions/checkout@v3
with:
submodules: true
ref: ${{ github.event.pull_request.head.sha }}

- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install vcpkg
run: |
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg && ./bootstrap-vcpkg.sh
echo "VCPKG_ROOT=${{github.workspace}}/vcpkg" >> $GITHUB_ENV
echo "${{github.workspace}}/vcpkg" >> $GITHUB_PATH
./vcpkg integrate install
shell: bash

- name: Install dependencies
run: python -m pip install -U pip "pybind11[global]" cmake build numpy pytest

- name: Build and install Python bindings
run: python -m pip install .

- name: Run tests
run: python -m pytest -v

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ build-backend = "setuptools.build_meta"

[tool.pytest.ini_options]
minversion = "6.0"
addopts = "-ra -q"
addopts = "-ra -q --color=yes"
log_cli = true # when true, messages are printed immediately
testpaths = [
"python/tests",
]
1 change: 0 additions & 1 deletion python/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
project(acquire-zarr-py)
cmake_policy(SET CMP0057 NEW)

execute_process(COMMAND python3 -m pybind11 --cmakedir
RESULT_VARIABLE pybind11_NOT_FOUND
Expand Down
Loading

0 comments on commit 7d6dd61

Please sign in to comment.