sixty-north / cosmic-ray

Mutation testing for Python
MIT License
556 stars 54 forks source link

[Feature Request] Make `pragma` Comments Behave Similarly to the Ones in Python's `coverage` #519

Open FloatingSunfish opened 3 years ago

FloatingSunfish commented 3 years ago

Currently, # pragma: no mutate comments only affect a single line.

The # pragma: no cover comments in Python's coverage tool work on both single lines and code blocks (e.g. functions, classes, if blocks, etc).

Here is a link to the official documentation.

The way pragma comments work for code blocks is that they are added at the end of the line that begins the block:

a = my_function1()
if debug:   # pragma: no cover
    msg = "blah blah"
    log_message(msg, a)
b = my_function2()