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

CI test FastApi fails on FastApi versions > 0.70.1 with Interrupted: 3 errors during collection #3684

Closed
3 tasks done
aleksul opened this issue Jan 17, 2022 · 2 comments
Closed
3 tasks done
Labels
bug V1 Bug related to Pydantic V1.X

Comments

@aleksul
Copy link
Contributor

aleksul commented Jan 17, 2022

Checks

  • I added a descriptive title to this issue
  • I have searched (google, github) for similar issues and couldn't find anything
  • I have read and followed the docs and still think this is a bug

Bug

Output of python -c "import pydantic.utils; print(pydantic.utils.version_info())":

I have installed locally, just to reproduce CI failure.

pydantic version: 1.9.0
pydantic compiled: False
   install path: /home/aleks/Projects/pydantic/pydantic
 python version: 3.7.12 (default, Jan 17 2022, 13:14:20)  [GCC 9.3.0]
       platform: Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-debian-bullseye-sid
optional deps. installed: ['devtools', 'dotenv', 'email-validator', 'typing-extensions']

Output of pytest:

Test session starts (platform: linux, Python 3.7.12, pytest 6.2.5, pytest-sugar 0.9.4)
rootdir: /home/aleks/Projects/pydantic/fastapi, configfile: pyproject.toml
plugins: sugar-0.9.4, mock-3.6.1, cov-3.0.0, hypothesis-6.31.6, anyio-3.5.0
collecting ...
―――――――――――――――――――――――――――― 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 ================================================
FAILED docs_src/app_testing/app_b_py310/test_main.py - TypeError: unsupported operand type(s) for |: 'type' and 'NoneT...
FAILED docs_src/sql_databases/sql_app_py310/tests/test_sql_app.py - TypeError: unsupported operand type(s) for |: 'typ...
FAILED docs_src/sql_databases/sql_app_py39/tests/test_sql_app.py - TypeError: 'type' object is not subscriptable
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 3 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Example

https://github.com/aleksul/pydantic/runs/4840835092?check_suite_focus=true

I've exported logs because github will delete them after some time:
test fastAPI.txt

@aleksul aleksul added the bug V1 Bug related to Pydantic V1.X label Jan 17, 2022
@dolfinus
Copy link
Contributor

Fixed in #3690

@PrettyWood
Copy link
Member

Indeed thanks @dolfinus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug V1 Bug related to Pydantic V1.X
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants