I'm running nose2 tests with the coverage plugin. I noticed that decorators, class declarations, and function definitions aren't being marked as covered, even though the "actual code" underneath them is. I found this answer , which suggests starting coverage "earlier."
How would I do this via nose2? I tried exporting NOSE_WITH_COVERAGE=True
, but that didn't seem to do anything.
Additional context: eventually we're hoping to plug these tests into Jenkins, if that matters.
ETA: adding a [coverage]
section with always-on = True
to my nose2.cfg
didn't work.
The fool-proof way to get coverage started earlier is to use coverage to run nose, instead of using nose to run coverage. For example, instead of:
$ nose2 blah blah blah
you can use:
$ coverage run -m nose2 blah blah blah
and then just leave out the nose coverage options from blah blah blah
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.