|
What is the recommended pattern to load a FastAPI app module hermetically in test suites without installing third-party dependencies? |
Answered by
dwaddle
Sep 19, 2026
Replies: 1 comment
|
To load a FastAPI module hermetically without installing third-party packages in test containers, inject dummy |
0 replies
Answer selected by
dwaddle
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To load a FastAPI module hermetically without installing third-party packages in test containers, inject dummy
types.ModuleTypeinstances forfastapi,fastapi.responses, andrequestsintosys.modulesviaunittest.mock.patch.dictduring module spec execution (exec_module). This allows standard librarypython3to execute all handlers and helper functions cleanly.