[TIP] replacing "break" with "continue" causes line to not be covered w/ coverage.py
Laurens Van Houtven
_ at lvh.cc
Sat Jul 2 14:22:57 PDT 2011
I'm experiencing some strange behavior. I have a loop, and when I continue
to the next element on some condition, it told me that line wasn't covered.
Then, I put a pdb.set_trace() in, and I saw that it was, in fact, being run.
I put a raise ValueError() instead of that "continue", and it raised. I
replaced "continue" with "break", and now coverage.py thinks the line is
What could be going on? Here's the diff:
=== modified file 'twisted/positioning/nmea.py'
--- twisted/positioning/nmea.py 2011-07-02 18:40:44 +0000
+++ twisted/positioning/nmea.py 2011-07-02 21:14:31 +0000
@@ -552,7 +552,7 @@
prn, azimuth, elevation, snr = values
if prn is None or snr is None:
satellite = base.Satellite(prn, azimuth, elevation, snr)
The code lives in lp:~lvh/twisted/positioning.
The strange thing is even trial --coverage (which is unrelated to
coverage.py...) thinks it's not covered. How can that be?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the testing-in-python