Skip to content

Commit

Permalink
✅ Update internal tests for latest Pydantic, including CI tweaks to i…
Browse files Browse the repository at this point in the history
…nstall the latest Pydantic (fastapi#12147)
  • Loading branch information
tiangolo authored Sep 6, 2024
1 parent d86f660 commit c411b81
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
if: steps.cache.outputs.cache-hit != 'true'
run: pip install -r requirements-tests.txt
- name: Install Pydantic v2
run: pip install "pydantic>=2.0.2,<3.0.0"
run: pip install --upgrade "pydantic>=2.0.2,<3.0.0"
- name: Lint
run: bash scripts/lint.sh

Expand Down Expand Up @@ -79,7 +79,7 @@ jobs:
run: pip install "pydantic>=1.10.0,<2.0.0"
- name: Install Pydantic v2
if: matrix.pydantic-version == 'pydantic-v2'
run: pip install "pydantic>=2.0.2,<3.0.0"
run: pip install --upgrade "pydantic>=2.0.2,<3.0.0"
- run: mkdir coverage
- name: Test
run: bash scripts/test.sh
Expand Down
27 changes: 20 additions & 7 deletions tests/test_openapi_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,26 @@ def test_openapi_schema():
"requestBody": {
"content": {
"application/json": {
"schema": {
"allOf": [{"$ref": "#/components/schemas/Item"}],
"title": "Item",
"examples": [
{"data": "Data in Body examples, example1"}
],
},
"schema": IsDict(
{
"$ref": "#/components/schemas/Item",
"examples": [
{"data": "Data in Body examples, example1"}
],
}
)
| IsDict(
{
# TODO: remove when deprecating Pydantic v1
"allOf": [
{"$ref": "#/components/schemas/Item"}
],
"title": "Item",
"examples": [
{"data": "Data in Body examples, example1"}
],
}
),
"examples": {
"Example One": {
"summary": "Example One Summary",
Expand Down

0 comments on commit c411b81

Please sign in to comment.