"# E:" lines (etc) in test files are ignored at the beginning of lines
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
As discovered in the unrelated https://github.com/python/mypy/pull/19494#discussion_r2243899624, "# E:" lines (etc) in test files are ignored at the beginning of lines. Having looked at the code, I've discovered this is because it desires the # to be preceded by a space, which is not present when the # is at the beginning of a line. This is bad because attempted error lines should not be silently ignored. (Although it is unlikely for someone to try to E an empty line.)
My PR #19546 will fix this. Edit: that would still be true, but #21172 is a much more minimal fix for this.
Easy repro:
[case testErrorCodeOnEmptyLine]
# E: This isn't a real message, and thus this test could never pass, although somehow it currently does :)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with mypy/test/data.py around line 536 and reproduce the behavior using the test case shown in the issue. Compare the proposed minimal fix in issue #21172, since the body says the broader approach in PR #19546 is no longer preferred. Done means the invalid beginning-of-line “# E:” assertion is no longer silently ignored.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 20/100