coverage.process_startup(): a similar stop method?

46 views
Skip to first unread message

Andrew

unread,
Nov 3, 2011, 6:02:22 AM11/3/11
to Coverage.py Development
Hi,
is there any way to stop coverage after a process_startup?
The context is that I have to coverage a Django application and I need
to cover
not unit tests but some field test so I launch django web server with
process_startup
method.

Thanks all bye,
Andrea

Ned Batchelder

unread,
Nov 3, 2011, 7:24:56 AM11/3/11
to coverag...@googlegroups.com, Andrew
Hi Andrea, there is no mechanism in place for stopping coverage other
than the end of the process. If it's inconvenient for you to stop the
process, you'll need to put in place some other way to stop coverage and
write the data. Two that come to mind are: 1) a timer on a separate
thread, and 2) a special URL that you can hit in your Django server to
do it.

--Ned.

Andrea Della Pietra

unread,
Nov 4, 2011, 6:53:47 AM11/4/11
to coverag...@googlegroups.com
Hi Ned and thanks for the response.
I haven't any problem to stop the process but if I kill Django main process no .coverage is produced
and if I kill Django subprocess a .coverage is produced but coverage data is always 0% and I don't understand why.
Solution 2 seems to me applicable only overriding some SocketServer's methods because Web Server instance process http requests in a "while True" cycle, and it's a bit intrusive for my needs.

Thanks anyway and regards,
Andrea
Reply all
Reply to author
Forward
0 new messages