Open goussous0 opened 7 months ago
I used this dirty hack. Yet it is quite simple and gets the work done.
dependencies = []
if "pytest" not in sys.modules:
dependencies.append(
Depends(
RateLimiter(...)
)
)
api_router = APIRouter(prefix="/api/v1", dependencies=dependencies)
# add your routes to `api_router`
app.include_router(api_router)
According to the github repo README.md I have to use
or startup event as mentioned on pypi but both approaches seems to result in the same error when trying to run pytests
The following is a basic recreation of the error
config/__init__.py
tests/__init__.py
the error output