coveragepy
coveragepy copied to clipboard
Question: How to get the coverage data for each incoming request on my web server.
consider a sample python application (https://github.com/keploy/samples-python/tree/main/django-postgres), I want to get the coverage data for each request coming to my server.
I am aware of dynamic-context, but that it is a different thing, it provides only one option (test_function).
You might need to try using the Coverage API, using start() and stop() around the request, and then examining the data each time. When you say "each request" I don't know if you mean every single request being made, or each different kind of request?
Hey @nedbat thanks for the response.
You might need to try using the Coverage API, using start() and stop() around the request, and then examining the data each time.
I am not sure how that can be done at the server side. I would be grateful for any insights.
Little background here: I want to develop a module that does this for any python server out there.
When you say "each request" I don't know if you mean every single request being made, or each different kind of request?
I meant every single API request being made to the server. In the context of sample app I linked in the issue description, it would mean any request which comes to the five endpoints.
solved this using middleware