https://prefect.io logo
Title
d

Daniel Alejandro Mesejo-Le贸n

03/11/2023, 6:46 PM
Hello everyone. I was following the Contributing Guide, but when I run
pytest tests
I get:
ImportError while loading conftest '/Users/daniel.mesejo/PycharmProjects/prefect/tests/conftest.py'.
tests/conftest.py:67: in <module>
    from prefect.testing.cli import *
src/prefect/testing/cli.py:7: in <module>
    from prefect.cli import app
src/prefect/cli/__init__.py:9: in <module>
    import prefect.cli.cloud
src/prefect/cli/cloud.py:58: in <module>
    login_api = FastAPI(on_startup=[set_login_api_ready_event])
../../opt/anaconda3/envs/prefect/lib/python3.8/site-packages/fastapi/applications.py:124: in __init__
    self.router: routing.APIRouter = routing.APIRouter(
../../opt/anaconda3/envs/prefect/lib/python3.8/site-packages/fastapi/routing.py:502: in __init__
    super().__init__(
../../opt/anaconda3/envs/prefect/lib/python3.8/site-packages/starlette/routing.py:592: in __init__
    warnings.warn(
E   DeprecationWarning: The on_startup and on_shutdown parameters are deprecated, and they will be removed on version 1.0. Use the lifespan parameter instead. See more about it on <https://www.starlette.io/lifespan/>.
This is because the latest version (0.94.0) of FastAPI uses the version 0.26.0.post1 of starlette, that it turn introduces the
DeprecationWarning
. The last update for FastAPI was done yesterday March 10th (see here). In the short term downgrading to 0.93.0 (
pip install fastapi==0.93.0
) solves the issue, but perhaps for the future is worth creating a ticket to start using the lifespan parameter. What would be the best course of action here? In any case I鈥檒l be happy to help 馃檪.
z

Zanie

03/13/2023, 3:03 PM
We鈥檒l want to first add an ignore for those warnings to our pytest configuration so we can run the test suite succesfully
Then we鈥檒l want a second pull request to use the new parameter 馃檪
Thanks for pointing it out!
Here鈥檚 the first part since our CI on
main
is failing
Here鈥檚 a tracking issue for the fix https://github.com/PrefectHQ/prefect/issues/8786
d

Daniel Alejandro Mesejo-Le贸n

03/13/2023, 3:50 PM
Thanks! I鈥檒l see if I can start working on it
z

Zanie

03/13/2023, 4:21 PM
Feel free to lmk if you have questions!