jeudi 26 mai 2016

How to calculate test coverage for unittests which hit django API?

I have a django project for which I want to calculate the code coverage.

The tests (based on Python unittests) live inside the project, but they are decoupled from Django. The tests hit some API of a pre-running django dev server and test its responses.

So if I run e.g. coverage.py report on these tests, it doesn't 'see' lines that were executed inside the django server which is being queried.

Is there a way I can calculate coverage without rewriting the tests?

One way I think of is some django app which hooks into a django project and watches which lines are executed, generating a report. Think profiler, but for lines, not time.

In this case I could plug that app into my django project, run the tests and generate the coverage report.

Aucun commentaire:

Enregistrer un commentaire