Skip to content

Commit b273b79

Browse files
committed
fix(ci): finish the 3.10 compat leg — test-side pydantic helpers, SYSTEM_PYTHON
The new tag-gated compat job (first exercise of the Python 3.10 / pydantic v1 half of the matrix) surfaced the remaining first-contact debt: - Tests called model_dump()/model_validate_json() on models directly; routed through the schema compat helpers like the analyzer code. - The venv-building CLI tests need a base interpreter that can create virtual environments; inside uv's venv on the runner the discovery walk has no anchor, so the compat job now sets SYSTEM_PYTHON — the escape hatch that error message documents. Verified locally on 3.10 + pydantic 1.10.26: every test that does not spawn a CLI subprocess passes; the subprocess ones fail locally only because ray 2.0.0 ships an x86_64 grpc wheel that Apple Silicon cannot load in child processes — the ubuntu runner imports it fine. 3.12: patched files 21/21 green.
1 parent 56aac4e commit b273b79

4 files changed

Lines changed: 13 additions & 6 deletions

File tree

.github/workflows/release.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ jobs:
3939

4040
- name: Run tests
4141
run: uv run pytest
42+
env:
43+
# The venv-building CLI tests must find a base interpreter that can
44+
# create virtual environments; inside uv's own venv the discovery
45+
# walk has no anchor on the runner, so hand it the setup-python one.
46+
SYSTEM_PYTHON: python3.10
4247

4348
release:
4449
needs: compat

test/test_call_site_body_convergence.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"""
88
import json
99

10-
from codeanalyzer.schema import strip_internal_only
10+
from codeanalyzer.schema import strip_internal_only, model_dump
1111
from codeanalyzer.schema.l1_body import populate_l1_body
1212
from codeanalyzer.schema.py_schema import (
1313
PyApplication, PyCallable, PyCallArgument, PyCallsite, PyModule,
@@ -64,7 +64,7 @@ def test_call_sites_is_stripped_at_emit_but_kept_when_serialized():
6464
"""
6565
app, fn = _app()
6666
populate_l1_body(app)
67-
dumped = app.model_dump(mode="json")
67+
dumped = model_dump(app, mode="json")
6868

6969
# Serialized form keeps it — this is what the cache persists.
7070
assert "call_sites" in dumped["symbol_table"]["a.py"]["functions"]["f"]
@@ -81,6 +81,6 @@ def test_accessed_symbols_and_local_variables_are_untouched():
8181
"""Only call_sites is redundant; these have no body{} representation to converge into."""
8282
app, fn = _app()
8383
populate_l1_body(app)
84-
callable_json = strip_internal_only(app.model_dump(mode="json"))["symbol_table"]["a.py"]["functions"]["f"]
84+
callable_json = strip_internal_only(model_dump(app, mode="json"))["symbol_table"]["a.py"]["functions"]["f"]
8585
assert "accessed_symbols" in callable_json
8686
assert "local_variables" in callable_json

test/test_entrypoint_pipeline.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from codeanalyzer.schema import model_dump
12
from pathlib import Path
23

34
import pytest
@@ -186,9 +187,9 @@ def test_running_the_pass_twice_does_not_duplicate_entrypoints(tmp_path: Path):
186187
)
187188

188189
detect_entrypoints(app, tmp_path)
189-
first = [e.model_dump() for e in fn.entrypoints]
190+
first = [model_dump(e) for e in fn.entrypoints]
190191
assert len(first) == 1
191192

192193
detect_entrypoints(app, tmp_path)
193-
second = [e.model_dump() for e in fn.entrypoints]
194+
second = [model_dump(e) for e in fn.entrypoints]
194195
assert second == first

test/test_v2_keystone.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from codeanalyzer.schema import model_validate_json
12
"""Stage-5 keystone conformance gates (issue #98).
23
34
Asserts key-for-key parity with the canonical schema-v2 keystone
@@ -184,5 +185,5 @@ def test_emitted_json_round_trips_through_the_analysis_model(tmp_path: Path):
184185
[sys.executable, "-m", "codeanalyzer", "-i", str(proj), "-a", "1", "--no-venv"],
185186
capture_output=True, text=True, check=True,
186187
).stdout
187-
a = Analysis.model_validate_json(out)
188+
a = model_validate_json(Analysis, out)
188189
assert a.schema_version == "2.0.0"

0 commit comments

Comments
 (0)