Opened 6 years ago

Closed 6 years ago

#7821 closed task (implemented)

Look into code coverage more

Reported by: atagar Owned by: atagar
Priority: Medium Milestone:
Component: Core Tor/Stem Version:
Severity: Keywords: testing
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

Stem has quite a bit of tests but I haven't personally run a code coverage tool to figure out what we're missing. Sean had a suggestion on this...

http://nedbatchelder.com/code/coverage/
http://pypi.python.org/pypi/coverage

I've used this on three projects (not counting Stem) and it helps
check that written tests are reaching all the dark crevices of one's
code.  If you have questions, I'm happy to help. Once installed, do:

1) coverage run --parallel-mode --branch --omit="test*" ./run_tests.py
-u -i -t RUN_NONE (or some variation)
2) coverage combine
3) coverage html
4) read the nice reports in the htmlcov/ directory

Child Tickets

Attachments (1)

stem-coverage-ec1078ccc39af8d1.tar.bz2 (263.5 KB) - added by robinson 6 years ago.
coverage.py HTML report for 2012-01-03

Download all attachments as: .zip

Change History (6)

Changed 6 years ago by robinson

coverage.py HTML report for 2012-01-03

comment:1 Changed 6 years ago by robinson

I attached a sample HTML coverage.py report for Stem at commit ec1078ccc39af8d1 on Jan. 3, 2013. This was generated using "./run_tests.py -u -i -t ONLINE"

comment:2 Changed 6 years ago by atagar

Yikes, coverage provides nice output. I'm curious about the output with both the ONLINE and RUN_ALL targets since that should give much more accurate information about the connection module. However, as gsathya pointed out to me yesterday we have some broken tests with that target. I'll try to fix them this weekend.

comment:3 Changed 6 years ago by robinson

Damian,

I'll try to run coverage.py with the ONLINE and RUN_ALL targets the weekend of Jan. 12, 2013, with whatever fixes you have applied by then. I've done this before and it is less than a 5-minute run time, so no big deal.

comment:4 Changed 6 years ago by atagar

Well, that's odd. I've fixed the integ testing issues...

https://gitweb.torproject.org/stem.git/commitdiff/69a2d6d8aba1e538bdaf7f0ca8d2c66c57bb99de
https://gitweb.torproject.org/stem.git/commitdiff/19d9a1ccde704ea05bd8e4b4231820a0b28df974

But when I run the RUN_ALL target with coverage it goes through a few test passes then hangs on 'test.integ.control.controller'. It reliably fails with coverage and works without. Pesky...

comment:5 Changed 6 years ago by atagar

Resolution: implemented
Status: newclosed

Abhishek was able to run coverage with the RUN_ALL target so guess it was just the version that I was using. Resolving.

Note: See TracTickets for help on using tickets.