-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Static and run-time tests for stubs #917
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
4e8d414
Convention for test data which uses APIs defined by Python stubs
vlasovskikh 4066d7f
Run-time + static tests for stubs
vlasovskikh 4f2e158
Mentioned both static and run-time checking in CONTRIBUTING
vlasovskikh 992df42
Made runtime_test.py executable
vlasovskikh 774d5ff
Ignore flake8 warnings about imports not at the top of the file for a…
vlasovskikh ba61c11
Removed debug output for checking Python version at Travis
vlasovskikh 41d5b7c
Install *_requirements.txt for *_test.py automatically during test run
vlasovskikh aa4ace1
Added a section about testing stubs with an example
vlasovskikh dfca122
Temporarily turned off running pytype for test_data
vlasovskikh 3a3c6ad
Reverted running pytype_test (pytd, as it turned out) for *.py files
vlasovskikh 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
Next
Next commit
Convention for test data which uses APIs defined by Python stubs
Currently we check only for syntax errors in stub files. The idea is to add test data for static analyzers similar to how it's done in DefinitelyTyped for TypeScript.
- Loading branch information
commit 4e8d414dd14f7282ddbc85a9207dae06f68160d3
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from collections import namedtuple | ||
|
||
|
||
def test_collections_namedtuple(): | ||
# type: () -> None | ||
Point = namedtuple('Point', 'x y') | ||
p = Point(1, 2) | ||
|
||
p._replace(y=3.14) | ||
p._asdict() | ||
p.x, p.y | ||
p[0] + p[1] | ||
p.index(1) | ||
Point._make([('x', 1), ('y', 3.14)]) |
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
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.
What's this change for?
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 changed it in order to run pytype on tests files which are regular Python files. Since I've disabled running pytype for them, I could revert this change as well.
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.
The existing
pytype_test.py
checkspyi
files using thepytd
tool. If you want to run againstpy
files, you'll need to run thepytype
executable.Sorry. I should have caught that earlier.
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.
If you do run pytype, you may have to run it as
TYPESHED_HOME=/some/path/ pytype
in order to point it at the typeshed version you're testing.