python / python/mypy

Add new syntax to let the mypy test file syntax anticipate --pretty output

Open
#20,811 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

topic-tests
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

The thing that makes #19510 complex is the differences in test output. One possible approach to this is to update the test output to be what it will be if --pretty is enabled. This is complicated by the fact that our current syntax for inline errors in the test data does not actually support what --pretty outputs. Adding that feature could possibly be useful.

(Additionally, https://github.com/python/mypy/issues/19940 should probably be fixed, and https://github.com/python/mypy/pull/19546 merged, before this issue is addressed, if one wants the process to be maximally smooth.)

Huh, it hadn't even occurred to me — there's no syntax for multi-line inline comments, is there? Nor for ignoring subsequent lines of a pretty comment in a test...

Originally posted by @wyattscarpenter in https://github.com/python/mypy/issues/19510#issuecomment-3140992574

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the existing inline-error test syntax and the discussions in #19510, #19940, and PR #19546 to understand the expected constraints. Define and implement syntax for multi-line pretty output, including ignoring subsequent lines, then verify that the relevant mypy test cases can express and validate --pretty output.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.