nose icon indicating copy to clipboard operation
nose copied to clipboard

--cover-omit support

Open diogobaeder opened this issue 12 years ago • 25 comments

I'd like to propose Nose to support the --omit argument from coverage.py, so that we can specify patterns to exclude files from coverage report.

Use case: South migrations created for Django are created inside packages from inside the project, but they're created automatically. Also, they're created by a third-party application, which maintains the tests for them. So, it makes no sense to give these files any coverage from within the project, since Django itself handles these files.

Does this make sense?

Thanks, guys! :-)

diogobaeder avatar May 02 '12 04:05 diogobaeder

Sounds good to me. Though as someone who has been burned by many a bad migration, I have to suggest running them with your tests, at least in continuous integration. :)

jpellerin avatar May 13 '12 12:05 jpellerin

Indeed a good point, jpellerin, but the problem is how we make coverage for the "down" functions, which IMO are a bit over-testing

diogobaeder avatar May 13 '12 15:05 diogobaeder

Yes please, this is a badly needed feature :)

Even better would be to support a .coveragerc file: http://nedbatchelder.com/code/coverage/config.html

dbrgn avatar Apr 26 '13 17:04 dbrgn

em.. will this feature be supported?

ouabing avatar Mar 10 '14 10:03 ouabing

I'm looking forward to this feature too...

vierno avatar Mar 21 '14 13:03 vierno

I'd like this to be added too.

shalakhin avatar May 25 '14 13:05 shalakhin

I'd like this to be supported too.

bobbyrenwick avatar Jun 18 '14 22:06 bobbyrenwick

+1

imkevinxu avatar Oct 02 '14 23:10 imkevinxu

Yet another +1!

svetlyak40wt avatar Oct 18 '14 14:10 svetlyak40wt

+1

kristaps avatar Nov 27 '14 13:11 kristaps

+1

rvikmanis avatar Nov 27 '14 13:11 rvikmanis

:+1:

daGrevis avatar Nov 27 '14 13:11 daGrevis

I don't mind adding this support, but is there any reason why you just don't run coverage outside of nose? In fact, Ned Batchelder recommended it at some point--though I can't find the reference. It definitely gets you more control of coverage's configuration and results.

jszakmeister avatar Dec 01 '14 10:12 jszakmeister

Could you elaborate on what you mean by running coverage outside of nose?

kristaps avatar Dec 01 '14 11:12 kristaps

You can do: coverage run -m nose.

Also, you can setup a .coveragerc file to inject options into coverage. I currently use this on a project:

[run]
omit =
  build.py
  fabfile.py
  pavement.py
  setup.py
  foobar/tests/*

jszakmeister avatar Dec 01 '14 11:12 jszakmeister

@dbrgn It seems like .coveragerc gets read if you run the coverage from nose...

mforbes avatar Mar 22 '15 03:03 mforbes

+1

shimont avatar Apr 15 '15 21:04 shimont

+1

ghost avatar Jun 17 '15 13:06 ghost

+1

marcelosalloum avatar Aug 17 '15 17:08 marcelosalloum

@mforbes is right, .coveragerc works

sprt avatar Aug 31 '15 20:08 sprt

+1

ranacseruet avatar Jun 05 '17 15:06 ranacseruet

+1

razat249 avatar Jun 23 '17 18:06 razat249

+1

richardsimoes avatar Jul 27 '18 23:07 richardsimoes

If you want to exclude completely: https://pypi.org/project/nose-exclude/

wstewarttennes avatar Aug 07 '18 19:08 wstewarttennes

Another alternative I found is to specify the folders you want to include in your coverage report. Add the following line to your .noserc file: cover-package=jobs,shared

richardsimoes avatar Dec 12 '18 03:12 richardsimoes