python / python/mypy

some tests with approved stubs have the wrong error

Open
#12,504 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

for example, the testLimitLegacyStubErrorVolume test:
https://github.com/python/mypy/blob/bd530392cdbe444c63cc21820ad7b9748ea9c816/test-data/unit/check-modules.test#L3015-L3018

since certifi is an approved stub, it should instead suggest installing them, like it does here:

>mypy -c "import certifi"
<string>:1: error: Library stubs not installed for "certifi" (or incompatible with Python 3.10)  [import]
<string>:1: note: Hint: "python3 -m pip install types-certifi"
<string>:1: note: (or run "mypy --install-types" to install all missing stub packages)
<string>:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
Found 1 error in 1 file (checked 1 source file)

but for some reason, these tests (and also the playground) don't do that

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 with test-data/unit/check-modules.test around testLimitLegacyStubErrorVolume and compare its expected error with the certifi example in the issue. Read the approved-stub entry in mypy/stubinfo.py and reproduce the behavior with the provided mypy command. Done means approved stubs suggest installing their types package consistently in the affected tests and playground behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.