You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This runs into Pydantic validation setting issues when running pytest tests. This is because some of the environment variables are not yet set when a test client is created. Currently my lazy solution in the app factory function is to add a parameter for enablig/disabling profiling:
Is this what is recommended? Is there a better way? Ideally I wouldn't have profiling in the tests, or at least would want that to be determined by passing an environment variable myself, rather than having to make code changes. Specifically, if there are any examples in the docs I can look at that would be much appreciated. Thanks!
The text was updated successfully, but these errors were encountered:
I have a FastAPI application, and have added Pyinstrument instrumentation to it using code similar to the code linked here.
The code suggests to have profiling configurable via a Settings object, such as one provided in Pydantic.
The problem with this is that in my case I have a Settings object which looks like this:
So when I try to do something like this inside my app factory function:
This runs into Pydantic validation setting issues when running pytest tests. This is because some of the environment variables are not yet set when a test client is created. Currently my lazy solution in the app factory function is to add a parameter for enablig/disabling profiling:
Is this what is recommended? Is there a better way? Ideally I wouldn't have profiling in the tests, or at least would want that to be determined by passing an environment variable myself, rather than having to make code changes. Specifically, if there are any examples in the docs I can look at that would be much appreciated. Thanks!
The text was updated successfully, but these errors were encountered: