Skip to content

Commit

Permalink
Add CI to run Python tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
ielis committed Jul 1, 2024
1 parent 60010d1 commit 6ce7f95
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
45 changes: 45 additions & 0 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This workflow will generate a Python protobuf bindings and type stubs with Maven and run Python tests.

name: Python CI with Maven and Pytest

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:

jobs:
run-python-ci:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Build with Maven
run: ./mvnw -B package -DskipTests # we run tests elsewhere

- name: Install Python bindings
run: |
cd python && python3 -m pip install .[test]
- name: Run Python tests
run: |
pytest
2 changes: 1 addition & 1 deletion docs/python.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ such as `bool`, `int`, `str`, or `float`, and the assignment will *NOT* work for
>>> pf.type = spherocytosis
Traceback (most recent call last):
...
AttributeError: Assignment not allowed to field "type" in protocol message object.
AttributeError: Assignment not allowed to composite field "type" in protocol message object.

To set a message field, we must use the `CopyFrom` function:

Expand Down

0 comments on commit 6ce7f95

Please sign in to comment.