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

tests: run: Add type annotations. #1076

Merged
merged 2 commits into from
Jul 11, 2021
Merged

Conversation

prah23
Copy link
Member

@prah23 prah23 commented Jul 11, 2021

What does this PR do?
Adds type annotations to the test_run.py file. Includes this file under the run-mypy tool to type-check.

Tested?

  • Manually
  • Existing tests (adapted, if necessary)
  • New tests added (for any new behavior)
  • Passed linting & tests (each commit)

Commit flow

  • refactor: tests: run: Add type annotations.
    This commit adds paramter and return type annotations or hints to the
    test_run.py file, that contains tests for it's counterpart run.py
    from the zulipterminal module, to make mypy checks consistent and
    improve code readability.
  • tools: Include test_run.py under files to be type-checked with mypy.
    This commit adds a new "tests" key to the repo_python_files dict to
    let mypy know which files to type check. A new list,
    type_consistent_testfiles is also added, to hold the list of test
    files that have been type-annotated incrementally till all the test
    files are consistent.

Notes & Questions

I've referred to the pytest and pytest-mock docs for the type annotations on some of the fixtures, is a reference link in the commit necessary? (one reference would then be to a CHANGELOG)

@prah23 prah23 mentioned this pull request Jul 11, 2021
3 tasks
prah23 added 2 commits July 11, 2021 16:15
This commit adds paramter and return type annotations or hints to the
`test_run.py` file, that contains tests for it's counterpart `run.py`
from  the `zulipterminal` module, to make mypy checks consistent and
improve code readability.

Small type fixups and explicit CaptureFixture import added by neiljp.
This commit adds a new "tests" key to the `repo_python_files` dict to
let mypy know which files to type check. A new list,
`type_consistent_testfiles` is also added, to hold the list of test
files that have been type-annotated incrementally till all the test
files are consistent.
@neiljp neiljp force-pushed the test_annotation_run branch from eb70237 to fccc589 Compare July 11, 2021 23:19
Copy link
Collaborator

@neiljp neiljp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prah23 Thanks for this first test type annotation work 👍 I've fixed the points below and will be merging shortly, but thought you'd find the review record useful for future reference.

@neiljp
Copy link
Collaborator

neiljp commented Jul 11, 2021

@prah23 Merging now! 🎉

@neiljp neiljp merged commit 2ec67b0 into zulip:main Jul 11, 2021
@neiljp neiljp added this to the Next Release milestone Jul 11, 2021
@prah23
Copy link
Member Author

prah23 commented Jul 12, 2021

Thanks for the feedback and the merge @neiljp!
Looking into making the types more accurate and stricter in the further PRs.

@zulipbot
Copy link
Member

Hello @zulip/server-refactoring members, this pull request was labeled with the "area: refactoring" label, so you may want to check it out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants