Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A
# pragma: no mutateafter the closing bracket of a multi-line statement is ignored, so that line is still mutated:The comment is the statement's trailing comment, but
visit_SimpleStatementLinerecords only the line the statement starts on (return max(), not the line the comment is on. #614 listed this as left alone. README:375 says the bare pragma disables mutation "on this single line", so this marks the comment's own line too. The start line stays marked, so nothing suppressed today becomes mutated.Real run (
mutmut runon a small package with the function above and a single-linereturn max(a + 1, b * 2) # pragma: no mutateas a control):main: 4 mutants inclosing, 2 of them onb * 2; the control has 0closing, both ona + 1; the control has 0Tests: a
PragmaVisitorcase and an end-to-end case intest_mutation.py. Withpragma_handling.pyreverted tomain, both fail ({3} == {3, 5};b / 2is generated).uv run pytest: 473 passed, 4 skipped; twotests/workers/test_timeout.pycases failed under load (that file fails 1–2 of 8 onmainhere too) and it passes 8/8 when run alone.pre-commit run --all-filesis clean.Not changed: when
)sits on a line of its own, its pragma covers that line and the first line only, so the arguments are still mutated.# pragma: no mutate start/endcovers a whole statement.AI assistance: drafted with Claude Opus 5.5 (
claude-opus-5-5); I ran the checks above.