Fix testing infrasucture for Pydantic 2 default#2041
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2041 +/- ##
==========================================
- Coverage 80.67% 80.64% -0.03%
==========================================
Files 107 107
Lines 11943 11946 +3
Branches 3415 3416 +1
==========================================
- Hits 9635 9634 -1
- Misses 1743 1744 +1
- Partials 565 568 +3 ☔ View full report in Codecov by Sentry. |
|
Notes to self: seems like we've never actually tested the output of the Pydantic generator, targeting v2, on Python 3.8 or 3.9. The 3.8 tests are failing with a lot of Makes sense, because that was introduced in Python 3.9 (https://docs.python.org/3/library/typing.html#typing.Annotated) On 3.9 the errors are mostly They also seem to be related to array test cases. Needs further investigation. |
|
oop how did i miss that. assigning myself bc these are my fault probs |
…dels with AnyShapeArray Hardcode Any name check since it's a special case before 3.11
|
fixed the array generation and version problems. unassigning myself bc that was the 'my fault' part. the remaining test failures look like they're from pydantic coercion, where a model like class C(BaseModel):
s1: Optional[bool] = Noneincorrectly validates with inst = C(s1=1.1)as C(s1=True)which is a pydantic coercion thing. idk what would be the desired behavior there - we could enable strict mode ( #1955 ) or we could mark the expected behavior as weird that it's happening only in older python versions though, don't know why that would be. |
|
Much appreciated @sneakers-the-rat! I will take care of the last few failures. |
|
I think our best move here is to just mark those narrows cases in the compliance tests as having coerce as the expected behavior. I didn't find any issues in the Pydantic repo that directly address what we're seeing on Python < 3.10 even though it directly contradicts what they say in their docs. The error is coming from Pydantic's Rust core. Because of that I'm not totally surprised that the issue seems to only effect certain Python versions on Ubuntu and not Windows. |
| pydantic-version: "2" | ||
| python-version: "3.10" | ||
| - os: windows-latest | ||
| python-version: "3.11" |
There was a problem hiding this comment.
not 3.12 right? (pydantic1 seems to be setting up a 3.12 environment)
There was a problem hiding this comment.
Right. These are excludes, and when we subtract them from the default permutations they leave us with only Python 3.8 and 3.12 on Windows.
There was a problem hiding this comment.
I see, I missed the excludes part.
| - `network` - (currently unused in CI) - tests marked as requiring network access/making network requests in order to succeed. | ||
| - `slow` - tests that are necessary to test technical correctness but are sufficiently long that it's worth excluding them during routine development/when running tests locally. | ||
| - `network` - (currently unused in CI) - tests marked as requiring network access/making network requests in order to succeed. | ||
| - `slow` - tests that are necessary to test technical correctness but are sufficiently long that it's worth excluding them during routine development/when running tests locally. |
|
Go team!!! |
Fixes #2040
Summary
poetry.lockfile, running tests directly viapytestor thetoxpy3xtestenvs will use Pydantic v2. These changes replace the existing "special case"pydantic2testenv with apydantic1testenv. The new testenv operates the same as the old one, except swapping Pydantic v1 for v2.main.yamltesting workflow had apydantic-versionvariable in the configuration matrix. With the addition of Python 3.11 and 3.12 to the testing matrix (Add support for Python 3.12 #1704), the matrix permutations were starting to get a little unruly. Here I'm splitting off Pydantic 1 testing into a separate workflow (.github/workflows/test-pydantic1.yaml). I then updated theexcludecombinations inmain.yamlso that what we end up running is:main.yaml)main.yaml)test-pydantic1.yaml)