Refactor tests/pytype_test.py#3065
Merged
JelleZijlstra merged 15 commits intopython:masterfrom Jun 19, 2019
Eric-Arellano:refactor-pytype
Merged
Refactor tests/pytype_test.py#3065JelleZijlstra merged 15 commits intopython:masterfrom Eric-Arellano:refactor-pytype
JelleZijlstra merged 15 commits intopython:masterfrom
Eric-Arellano:refactor-pytype
Conversation
It's much easier to understand pytype.io than io, which was shadowing the builtin!
* Set shebang * Classes are always new type
Results in less implementation details being exposed at the top level of the module.
It makes that function a little bit easier to understand. We don't need to keep re-evaluating the value every time.
… so that pytype_test() is more focused The logic belonged in main(). In the process, those two functions are refactored.
It is only ever used to do one thing. This allows us to remove the _parse() helper function.
rchen152
requested changes
Jun 17, 2019
Collaborator
rchen152
left a comment
There was a problem hiding this comment.
Thanks for the refactor! I noticed one typo and one issue with the --dry-run command.
rchen152
approved these changes
Jun 17, 2019
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
While working on #3062, the
tests/pytype_test.pyfile has been failing and it was realized that the file could be refactored (#3062 (comment)).This does the following to try to improve the readability while preserving all original behavior:
.format()instead of%for string interpolation.raise SystemExit()rather than manually managing return codes and callingsys.exit().main()instead ofpytype_test().run_pytype()less generic. It no longer accepts genericargs, because it does not need that much flexibility. This allowed removing_parse().check_subdirs_discoverable()andcheck_python_exes_runnable.determine_files_to_test().print()statement to run with--print-stderrupon failures for more useful output.