Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add snippet tests using mypy #445

Closed
wants to merge 1 commit into from
Closed

Add snippet tests using mypy #445

wants to merge 1 commit into from

Conversation

Josverl
Copy link
Owner

@Josverl Josverl commented Nov 6, 2023

The Goal is to run mypy across all check_ and feature_ folders by re-use the same approach as for the pyright snippet test.

Parsing mypy output
There is no simple way to get machine readable output from mypy

workaround: regex hack in the mypy-vscode extension:

import re

pattern = r'^(?P<file>[^:\n]+):((?P<line>\d+):)?((?P<column>\d+):)? (?P<type>\w+): (?P<message>.*)$'

Changes to stubs:
One challenge is that mypy does not allow a replacement stdlib to be used , at least not for all modules.
Specificaly the sys.pyi module seems to be a blocker as mypy just refuses to run if it is included.
A simple /blunt approach would be to just delete the typings/sys.pyi file before running the test.

@Josverl Josverl added enhancement New feature or request Quality labels Nov 6, 2023
@Josverl Josverl self-assigned this Nov 6, 2023
Signed-off-by: GitHub <noreply@github.com>
@Josverl
Copy link
Owner Author

Josverl commented Dec 29, 2023

implemented in : Josverl/micropython-stubs#739

@Josverl Josverl closed this Dec 29, 2023
@Josverl Josverl deleted the dev/mypy_snippets branch December 29, 2023 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant