Wednesday, 2 June 2021

coverage API in a gunicorn wsgi django server

I am using the coverage 5.5 API to run code coverage on my server. This server is written using Django.

I have implemented the solution as per this answer -- https://stackoverflow.com/a/20689873/2996407

When I start up my server on my localhost using manage.py runserver and then shut it after some time, the code coverage report is generated as expected and correctly indicates the code coverage as well.

However, on my firm's staging env, the server is run as a docker container wherein 8 gunicorn workers are spawned. 8 individual coverage files are being generated as per the solution above which is expected as well. However, the report doesn't have any coverage. The only coverage that is being done is of empty __init__.py files.

The above SO answer suggests using a single gunicorn worker, but I don't have the option to do that. However, it suggests creating coverage files per worker which is happening as expected. But no luck in getting the coverage report from those.

I started the gunicorn server on my Mac and coverage is coming in fine. However, on the staging env which runs Ubuntu, there is no coverage. Can it be an OS related issue?



from coverage API in a gunicorn wsgi django server

No comments:

Post a Comment