0

While PyBuilder Coverage is great excluding files, I could not find a property to set or any other way to exclude specific function or line of code.

For example I have a RESTFUL service that unittest tests, but i also have some functions outise of tested classes that I don't want to test explicitly. if that would be a standalone Coverage execution then it would be possible to change Coverage configuration file .coveragerc to something with below

[report]
exclude_lines = def MyUndesiredToBeTestedFunction

However, I could not find no obvious access to it from PyBuilder.

Any help of in finding Coverage configuration file .coveragerc that is used by PyBuilder run or other solution is welcomed!

1 Answer 1

1

for me it works if I place the .coveragerc file in the project root of my pybuilder project (pybuilder verion 0.11.10) with the following example content:

[report]
# Regexes for lines to exclude from consideration
exclude_lines =
    # Have to re-enable the standard pragma
    pragma: no cover
    # custom
    def __[a-zA-Z]+\(

Tips:

  • assure your regex is correct
  • try with the .* regex (coverage should then be 100%)
Sign up to request clarification or add additional context in comments.

1 Comment

Fantastic! Thanks a lot!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.