We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am working on a big project where we often use the the match statement like so:
match something: case type_1(): logic_1() case type_2(): logic_2(): case _: assert_never(something)
In this code example the default case should never happen, but sometimes we also have:
match something: case type_1(): logic_1() case type_2(): logic_2(): case _: print("Default case")
When running coverage, I want to exclude all the assert_never lines because they should never run, so I use this configuration option:
assert_never
exclude_lines = assert_never
This removes these lines from the coverage report, but the case _ lines are still reported as missing.
case _
If I do this:
exclude_lines = case _
Then the entire block is excluded, including the print statement, which I do want to ensure coverage on.
Another approach is to use the # pragma: no cover comment, but we have hundreds of these cases and that would be very inconvenient to use.
# pragma: no cover
How can I configure coverage to exclude case _ when the only thing I have inside is assert_never, but not exclude it in other cases?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I am working on a big project where we often use the the match statement like so:
In this code example the default case should never happen, but sometimes we also have:
When running coverage, I want to exclude all the
assert_never
lines because they should never run, so I use this configuration option:exclude_lines = assert_never
This removes these lines from the coverage report, but the
case _
lines are still reported as missing.If I do this:
exclude_lines = case _
Then the entire block is excluded, including the print statement, which I do want to ensure coverage on.
Another approach is to use the
# pragma: no cover
comment, but we have hundreds of these cases and that would be very inconvenient to use.How can I configure coverage to exclude
case _
when the only thing I have inside isassert_never
, but not exclude it in other cases?The text was updated successfully, but these errors were encountered: