Hi,

I'd like to get coverage.py running against my code base. The code consists 
of standard Django, some Celery code, some django-viewflow code and some 
Celery-and-django-viewflow code [1]. The main problem I see is that if I 
say "coverage -p manage.py runserver ...", I need a way for the server to 
exit in a way which allows coverage to end the run and write its output. 
For now, I achieve this by hacking in a specific view and arranging to call 
"_thread.interrupt_main()" at an appropriate time. This indeed causes a 
coverage output file to be written.

Unfortunately, the recorded results only show the static reading of the 
code files, so that class and function definitions are read, but no 
function body lines show up as covered. I suspected this might have 
something to do with spawned processes, so I have tried using "runserver 
--noreload" to avoid the second process, but to no avail.

Why is the normally executed code path not shown as executed? AFAIK, there 
should be no multi-processing or similar in play...am I mistaken in that 
regard?

Thanks, Shaheed

P.S. In separate attempts, I tried all the relevant techniques in this 
StackOverflow discussion 
<https://stackoverflow.com/questions/22726449/django-test-coverage-vs-code-coverage>
 
such as using the coverage.py API in manage.py.

[1] I realise that:

   - Celery and coverage.py are not comfortable bedfellows (I believe this 
   is due to Celery using its own billard package, rather then generic 
   multiprocessing, which coverage.py apparently knows about).
   - There are standard recipies for getting coverage.py running when using 
   "manage.py test", but the tests in my current project are not run this way; 
   instead, pytest is used to invoke the tests, most of which use Selenium.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/37d3ac9b-b43c-4781-8809-1aac1274e6b2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to