Alex Rivera | Logout

How can I exclude South migrations from coverage reports using coverage.py

Asked 2010-12-21T15:21:37.723
31

I use coverage.py to check the test coverage of my django application. However since I use South for my database migrations, all those files show up with 0% and mess up the overall percentage.

I already tried using --omit=*migrations* in both run and report (and both) but that didn't work.

I tried versions 3.4 and latest revision from Bitbucket as of Dec 20th 2010 with the same result.

Any ideas how I can get coverage.py to actually ignore the migrations folders?

Edit
Report

1 Answer

27

You should be able to match against the migrations directory to omit those files. Have you tried quoting the argument? Depending on your OS and shell, it may be expanding those asterisks prematurely. Try it like this:

--omit='*migrations*'

Alternately, you could put the switch into a .coveragerc file:

[run]
omit = *migrations*
answered 2010-12-22T03:23:47.500

Your Answer