简体   繁体   中英

Skipping files from coverage

I have a very different requirement to exclude some files from test coverage.

I have a few files which are meant to work on Linux and not on Mac OS X and based on the underline platform I either run the test or don't. I have addressed running test cases based on platform, but need to somehow exclude that particular file from test coverage as well.

Can I apply the condition for the platform to a config file where we omit files from coverage?

Most code coverage tools will allow you to configure which files you are measuring code coverage for. The exact answer will depend on the coverage tool you are using.

As you have tagged python, I am going to assume you are using the coverage tool (from pip install coverage ). In this case, you can use the omit option in the settings to remove the files you don't want to measure. More information can be found in their documentation .

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM