Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to ignore / omit / exclude files during test coverage?

In order to get 100% test coverage, I need to ignore some file(s) in python.

I searched the web and I found nosetests which I don't want to use.

I also found that I can edit my .coveragerc file and omit files and functions, when running my tests using intellij (with unittest framework), it didn't manage to use .coveragerc file.

Any idea how to ignore / omit / exclude files during test coverage ?

How can I run the test using this file as a parameter ?

like image 530
roeygol Avatar asked Apr 23 '17 12:04

roeygol


1 Answers

You can use this command in your .coveragerc file.

# .coveragerc
[report]
show_missing = True
omit =
    junk/*

You include the path of files you want to omit under the omit command, for example, I want to omit every file in the junk folder hence my use of junk/*.

like image 180
proton Avatar answered Nov 06 '22 06:11

proton