-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add a mypy self test #4337
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
Merged
Merged
Add a mypy self test #4337
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8237c1d
Add a mypy self test
srittau fc3251f
Remove unused import
srittau 75efba0
Use mypy self check config
srittau 933d4fd
Run mypy test suite with GitHub Actions
srittau ba9c5ad
Use mypy 0.790
srittau 8cff76e
Install third party packages needed
7c7d145
Check mypy master (but using a released mypy)
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,39 @@ | ||
#!/usr/bin/env python3 | ||
"""Script to run mypy's test suite against this version of typeshed.""" | ||
"""Script to run mypy against its own code base.""" | ||
|
||
from pathlib import Path | ||
import shutil | ||
import subprocess | ||
import sys | ||
import tempfile | ||
|
||
MYPY_VERSION = "0.790" | ||
|
||
if __name__ == '__main__': | ||
|
||
if __name__ == "__main__": | ||
with tempfile.TemporaryDirectory() as tempdir: | ||
dirpath = Path(tempdir) | ||
subprocess.run(['python2.7', '-m', 'pip', 'install', '--user', 'typing'], check=True) | ||
subprocess.run(['git', 'clone', '--depth', '1', 'git://github.com/python/mypy', | ||
str(dirpath / 'mypy')], check=True) | ||
subprocess.run([sys.executable, '-m', 'pip', 'install', '-U', '-r', | ||
str(dirpath / 'mypy/test-requirements.txt')], check=True) | ||
shutil.copytree('stdlib', str(dirpath / 'mypy/mypy/typeshed/stdlib')) | ||
shutil.copytree('third_party', str(dirpath / 'mypy/mypy/typeshed/third_party')) | ||
subprocess.run( | ||
["git", "clone", "--depth", "1", "git://github.com/python/mypy", str(dirpath)], | ||
check=True, | ||
) | ||
try: | ||
subprocess.run(['pytest', '-n12'], cwd=str(dirpath / 'mypy'), check=True) | ||
subprocess.run([sys.executable, "-m", "pip", "install", f"mypy=={MYPY_VERSION}"], check=True) | ||
subprocess.run([sys.executable, "-m", "pip", "install", "-r", dirpath / "test-requirements.txt"], check=True) | ||
subprocess.run( | ||
[ | ||
"mypy", | ||
"--config-file", | ||
dirpath / "mypy_self_check.ini", | ||
"--custom-typeshed-dir", | ||
".", | ||
dirpath / "mypy", | ||
dirpath / "mypyc", | ||
], | ||
check=True, | ||
) | ||
except subprocess.CalledProcessError as e: | ||
print('mypy tests failed', file=sys.stderr) | ||
print("mypy self test failed", file=sys.stderr) | ||
sys.exit(e.returncode) | ||
else: | ||
print('mypy tests succeeded', file=sys.stderr) | ||
print("mypy self test succeeded", file=sys.stderr) | ||
sys.exit(0) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env python3 | ||
"""Script to run mypy's test suite against this version of typeshed.""" | ||
|
||
from pathlib import Path | ||
import shutil | ||
import subprocess | ||
import sys | ||
import tempfile | ||
|
||
|
||
if __name__ == '__main__': | ||
with tempfile.TemporaryDirectory() as tempdir: | ||
dirpath = Path(tempdir) | ||
subprocess.run(['python2.7', '-m', 'pip', 'install', '--user', 'typing'], check=True) | ||
subprocess.run(['git', 'clone', '--depth', '1', 'git://github.com/python/mypy', | ||
str(dirpath / 'mypy')], check=True) | ||
subprocess.run([sys.executable, '-m', 'pip', 'install', '-U', '-r', | ||
str(dirpath / 'mypy/test-requirements.txt')], check=True) | ||
shutil.copytree('stdlib', str(dirpath / 'mypy/mypy/typeshed/stdlib')) | ||
shutil.copytree('third_party', str(dirpath / 'mypy/mypy/typeshed/third_party')) | ||
try: | ||
subprocess.run(['pytest', '-n12'], cwd=str(dirpath / 'mypy'), check=True) | ||
except subprocess.CalledProcessError as e: | ||
print('mypy tests failed', file=sys.stderr) | ||
sys.exit(e.returncode) | ||
else: | ||
print('mypy tests succeeded', file=sys.stderr) | ||
sys.exit(0) |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe this should be
-n auto
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just moved this file from the old
mypy_selftest.py
. I'd consider changes to it out of scope of this PR.