Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix fastAPI tests workflow #3654

Closed
wants to merge 1 commit into from
Closed

Fix fastAPI tests workflow #3654

wants to merge 1 commit into from

Conversation

dolfinus
Copy link
Contributor

@dolfinus dolfinus commented Jan 10, 2022

Change Summary

After tiangolo/fastapi#3712 CI workflow test fastAPI started constantly failing:
https://github.com/dolfinus/pydantic/runs/4766269380?check_suite_focus=true

============================= test session starts ==============================
platform linux -- Python 3.7.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /home/runner/work/pydantic/pydantic/fastapi, configfile: pyproject.toml
plugins: anyio-3.4.0, sugar-0.9.4, hypothesis-6.31.6, cov-3.0.0, mock-3.6.1
collected 1244 items / 3 errors / 1241 selected

==================================== ERRORS ====================================
________ ERROR collecting docs_src/app_testing/app_b_py310/test_main.py ________
docs_src/app_testing/app_b_py310/test_main.py:3: in <module>
    from .main import app
docs_src/app_testing/app_b_py310/main.py:14: in <module>
    class Item(BaseModel):
docs_src/app_testing/app_b_py310/main.py:17: in Item
    description: str | None = None
E   TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'
_ ERROR collecting docs_src/sql_databases/sql_app_py310/tests/test_sql_app.py __
docs_src/sql_databases/sql_app_py310/tests/test_sql_app.py:6: in <module>
    from ..main import app, get_db
docs_src/sql_databases/sql_app_py310/main.py:4: in <module>
    from . import crud, models, schemas
docs_src/sql_databases/sql_app_py310/crud.py:3: in <module>
    from . import models, schemas
docs_src/sql_databases/sql_app_py310/schemas.py:4: in <module>
    class ItemBase(BaseModel):
docs_src/sql_databases/sql_app_py310/schemas.py:6: in ItemBase
    description: str | None = None
E   TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'
__ ERROR collecting docs_src/sql_databases/sql_app_py39/tests/test_sql_app.py __
docs_src/sql_databases/sql_app_py39/tests/test_sql_app.py:6: in <module>
    from ..main import app, get_db
docs_src/sql_databases/sql_app_py39/main.py:4: in <module>
    from . import crud, models, schemas
docs_src/sql_databases/sql_app_py39/crud.py:3: in <module>
    from . import models, schemas
docs_src/sql_databases/sql_app_py39/schemas.py:31: in <module>
    class User(UserBase):
docs_src/sql_databases/sql_app_py39/schemas.py:34: in User
    items: list[Item] = []
E   TypeError: 'type' object is not subscriptable
=========================== short test summary info ============================
ERROR docs_src/app_testing/app_b_py310/test_main.py - TypeError: unsupported ...
ERROR docs_src/sql_databases/sql_app_py310/tests/test_sql_app.py - TypeError:...
ERROR docs_src/sql_databases/sql_app_py39/tests/test_sql_app.py - TypeError: ...
!!!!!!!!!!!!!!!!!!! Interrupted: 3 errors during collection !!!!!!!!!!!!!!!!!!!!
============================== 3 errors in 4.68s ===============================

This is because list[Item] syntax used here is not valid in Python3.7 version used in the CI workflow.

So I've upgraded it to Python 3.10.

Related issue number

fix #3684

Checklist

  • Unit tests for the changes exist
  • Tests pass on CI and coverage remains at 100%
  • Documentation reflects the changes where applicable
  • changes/<pull request or issue id>-<github username>.md file added describing change
    (see changes/README.md for details)
  • My PR is ready to review, please add a comment including the phrase "please review" to assign reviewers

@dolfinus
Copy link
Contributor Author

please review

@aleksul
Copy link
Contributor

aleksul commented Jan 17, 2022

fixes #3684

@dolfinus
Copy link
Contributor Author

dolfinus commented Jan 17, 2022

Currently CI/CD workflow is failing because of this issue: tiangolo/fastapi#4409

@PrettyWood
Copy link
Member

I already fixed the CI in #3642 but opened #3690 to merge the fix directly.
Thanks though for the PR!

@PrettyWood PrettyWood closed this Jan 17, 2022
@dolfinus dolfinus deleted the fix_fastapi_docs_build branch January 17, 2022 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CI test FastApi fails on FastApi versions > 0.70.1 with Interrupted: 3 errors during collection
4 participants