Skip to content

Commit 5b2df1a

Browse files
authored
fix: python tests (#49)
1 parent 07aa910 commit 5b2df1a

File tree

4 files changed

+34
-32
lines changed

4 files changed

+34
-32
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,25 @@ jobs:
2929
run: cargo check --workspace
3030
- name: cargo test
3131
run: cargo test
32+
python-test:
33+
name: Test Python
34+
runs-on: ubuntu-latest
35+
defaults:
36+
run:
37+
working-directory: python
38+
steps:
39+
- uses: actions/checkout@v4
40+
- uses: astral-sh/setup-uv@v3
41+
with:
42+
enable-cache: true
43+
- uses: actions/setup-python@v5
44+
with:
45+
python-version-file: python/.python-version
46+
- name: Install
47+
run: uv sync --dev
48+
- name: Check
49+
run: uv run mypy . && uv run ruff check && uv run ruff format --check
50+
- name: Test
51+
run: uv run pytest
52+
- name: CLI smoke test
53+
run: uv run cql2 < ../examples/text/example01.txt

.github/workflows/python.yml

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
branches:
66
- main
77
tags:
8-
- 'v*'
8+
- "v*"
99
paths:
1010
- python/**
1111
pull_request:
@@ -21,27 +21,6 @@ permissions:
2121
contents: read
2222

2323
jobs:
24-
test:
25-
runs-on: ubuntu-latest
26-
defaults:
27-
run:
28-
working-directory: python
29-
steps:
30-
- uses: actions/checkout@v4
31-
- uses: astral-sh/setup-uv@v3
32-
with:
33-
enable-cache: true
34-
- uses: actions/setup-python@v5
35-
with:
36-
python-version-file: python/.python-version
37-
- name: Install
38-
run: uv sync --dev
39-
- name: Check
40-
run: uv run mypy . && uv run ruff check && uv run ruff format --check
41-
- name: Test
42-
run: uv run pytest
43-
- name: CLI smoke test
44-
run: uv run cql2 < ../fixtures/text/example01.txt
4524
linux:
4625
runs-on: ${{ matrix.platform.runner }}
4726
strategy:
@@ -69,7 +48,7 @@ jobs:
6948
with:
7049
target: ${{ matrix.platform.target }}
7150
args: --release --out dist --find-interpreter -m python/Cargo.toml
72-
sccache: 'true'
51+
sccache: "true"
7352
manylinux: auto
7453
- name: Upload wheels
7554
uses: actions/upload-artifact@v4
@@ -100,7 +79,7 @@ jobs:
10079
with:
10180
target: ${{ matrix.platform.target }}
10281
args: --release --out dist --find-interpreter -m python/Cargo.toml
103-
sccache: 'true'
82+
sccache: "true"
10483
manylinux: musllinux_1_2
10584
- name: Upload wheels
10685
uses: actions/upload-artifact@v4
@@ -128,7 +107,7 @@ jobs:
128107
with:
129108
target: ${{ matrix.platform.target }}
130109
args: --release --out dist --find-interpreter -m python/Cargo.toml
131-
sccache: 'true'
110+
sccache: "true"
132111
- name: Upload wheels
133112
uses: actions/upload-artifact@v4
134113
with:
@@ -154,7 +133,7 @@ jobs:
154133
with:
155134
target: ${{ matrix.platform.target }}
156135
args: --release --out dist --find-interpreter -m python/Cargo.toml
157-
sccache: 'true'
136+
sccache: "true"
158137
- name: Upload wheels
159138
uses: actions/upload-artifact@v4
160139
with:
@@ -194,9 +173,9 @@ jobs:
194173
- name: Generate artifact attestation
195174
uses: actions/attest-build-provenance@v1
196175
with:
197-
subject-path: 'wheels-*/*'
176+
subject-path: "wheels-*/*"
198177
- name: Publish to PyPI
199-
if: "startsWith(github.ref, 'refs/tags/')"
178+
if: startsWith(github.ref, 'refs/tags/')
200179
uses: PyO3/maturin-action@v1
201180
env:
202181
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}

python/tests/conftest.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
import pytest
21
import json
3-
from typing import Any
42
from pathlib import Path
3+
from typing import Any
4+
5+
import pytest
56

67

78
@pytest.fixture
89
def fixtures() -> Path:
9-
return Path(__file__).parents[2] / "fixtures"
10+
return Path(__file__).parents[2] / "examples"
1011

1112

1213
@pytest.fixture

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)