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 script to run monkeytype typing on test suite #14440

Merged

Conversation

MartinHjelmare
Copy link
Member

@MartinHjelmare MartinHjelmare commented May 13, 2018

Description:

  • The monkeytype script takes an optional argument to specify a test module or directory to run. Otherwise the whole test suite will run.
  • Add monkeytype sqlite db to gitignore.

See this instagram blog post for a description of the workflow involved to use the monkeytype program.

Basic workflow:

  1. Run script/monkeytype tests/path/to/your_test_module.py.
  2. Run monkeytype stub homeassistant.your_actual_module.
  3. Look at output from the monkeytyped typing stub. If not totally bad, apply the stub to your module. You most likely will need to manually edit the typing in the last step.
  4. Run monkeytype apply homeassistant.your_actual_module.
  5. Check the diff and manually correct the typing if needed. Commit, push the branch and make a PR.

Note:
Applying a monkeytyped stub to a module that has existing typing annotations might error and not work. This tool is most useful for totally untyped modules.

https://developers.home-assistant.io/docs/en/development_typing.html

Related issue (if applicable):
#14410 (comment)

Checklist:

  • The code change is tested and works locally.

* The monkeytype script takes an optional argument to specify a test
  module or directory to run. Otherwise the whole test suite will run.
* Add monkeytype sqlite db to gitignore.
@homeassistant homeassistant added cla-signed small-pr PRs with less than 30 lines. labels May 13, 2018
@MartinHjelmare
Copy link
Member Author

CC @andrey-git

@balloob
Copy link
Member

balloob commented Jun 7, 2018

Can you add a page to https://developers.home-assistant.io/ with instructions ?

@MartinHjelmare MartinHjelmare merged commit 4048ad3 into home-assistant:dev Jun 21, 2018
@MartinHjelmare MartinHjelmare deleted the add-monkey-type-script branch June 21, 2018 13:06
eavanvalkenburg pushed a commit to eavanvalkenburg/home-assistant that referenced this pull request Jun 28, 2018
* The monkeytype script takes an optional argument to specify a test
  module or directory to run. Otherwise the whole test suite will run.
* Add monkeytype sqlite db to gitignore.
@balloob balloob mentioned this pull request Jul 6, 2018
girlpunk pushed a commit to girlpunk/home-assistant that referenced this pull request Sep 4, 2018
* The monkeytype script takes an optional argument to specify a test
  module or directory to run. Otherwise the whole test suite will run.
* Add monkeytype sqlite db to gitignore.
@home-assistant home-assistant locked and limited conversation to collaborators Dec 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed small-pr PRs with less than 30 lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants