tortoise / tortoise-orm

Familiar asyncio ORM for python, built with relations in mind
https://tortoise.github.io
Apache License 2.0
4.58k stars 378 forks source link

Enhancement for FastAPI lifespan support (#1371) #1541

Closed waketzheng closed 5 months ago

waketzheng commented 9 months ago

Description

Support register in fastapi's lifespan and leave register_tortoise there to compare old version

Motivation and Context

For some running projects, people may want to only upgrade dependencies without changing any code.

While for new project, it is more flexibility to use async with format to register db.

How Has This Been Tested?

make test
cd examples/fastapi && PYTHONPATH=. pytest _tests.py

Checklist:

MihaiBalint commented 6 months ago

Would be nice to have this merged

abondar commented 5 months ago

Hi!

Could you please rebase it to actual develop branch

coveralls commented 5 months ago

Pull Request Test Coverage Report for Build 8856984032

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
tortoise/contrib/fastapi/init.py 0 51 0.0%
<!-- Total: 0 51 0.0% -->
Totals Coverage Status
Change from base Build 8850757408: -0.5%
Covered Lines: 5733
Relevant Lines: 6424

💛 - Coveralls