Skip to content

Commit

Permalink
Test on Pydantic v1 and v2
Browse files Browse the repository at this point in the history
Adds a Pydantic axis to the test matrix
  • Loading branch information
nickstenning committed Aug 19, 2024
1 parent 6daacff commit 0459fe3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,13 @@ jobs:
run: make test-go

test-python:
name: "Test Python ${{ matrix.python-version }}"
name: "Test Python ${{ matrix.python-version }} + Pydantic v${{ matrix.pydantic }}"
needs: build-python
runs-on: ubuntu-latest-8-cores
strategy:
fail-fast: false
matrix:
pydantic: ["1", "2"]
python-version: ${{ fromJson(needs.build-python.outputs.python-versions) }}
steps:
- name: Download pre-built packages
Expand All @@ -111,7 +112,7 @@ jobs:
- name: Remove src to ensure tests run against wheel
run: rm -rf python/cog
- name: Test
run: python -Im tox run --installpkg "$COG_WHEEL" -e ${{ env.TOX_PYTHON }}-tests
run: python -Im tox run --installpkg "$COG_WHEEL" -e ${{ env.TOX_PYTHON }}-pydantic${{ matrix.pydantic }}-tests

# cannot run this on mac due to licensing issues: https://github.com/actions/virtual-environments/issues/2150
test-integration:
Expand Down
5 changes: 4 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tox]
min_version = 4
env_list =
py3{7,8,9,10,11,12,13}-tests
py3{7,8,9,10,11,12,13}-pydantic{1,2}-tests
lint
typecheck
integration
Expand All @@ -18,6 +18,9 @@ addopts = --timeout=10
package = wheel
# Build the same wheel for all environments
wheel_build_env = .pkg
deps =
pydantic1: pydantic>=1,<2
pydantic2: pydantic>=2,<3
extras =
tests: tests
pass_env =
Expand Down

0 comments on commit 0459fe3

Please sign in to comment.