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 mypy tests to check static typing #154

Merged
merged 1 commit into from Aug 20, 2019

Conversation

kyrofa
Copy link
Member

@kyrofa kyrofa commented Aug 9, 2019

This uses the newly-added ament_mypy package.

This uses the newly-added ament_mypy package.

Signed-off-by: Kyle Fazzari <kyle@canonical.com>
@pytest.mark.mypy
@pytest.mark.linter
def test_mypy():
assert main(argv=[]) == 0, 'Found errors'
Copy link
Member

Choose a reason for hiding this comment

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

How does this innovation work?
Does it just test all source .py files in the parent package the test file is located under?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, at this point it will be the .py files in this package only. We went back and forth on the PR setting the MYPYPATH in different ways, but ended up shipping the simplest thing that worked while we continue discussing how that should be done.

extra_files.extend(package_files('sros2/policy/schemas'))
extra_files.extend(package_files('sros2/policy/templates'))

extra_files = (
Copy link
Member

Choose a reason for hiding this comment

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

Is this change relevant, and if so how?

Copy link
Member Author

Choose a reason for hiding this comment

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

It allows mypy to determine the type without us needing to add it manually.

@jacobperron
Copy link
Member

jacobperron commented Aug 19, 2019

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

Edit: re-triggered now that ament/ament_lint#182 is merged

@jacobperron
Copy link
Member

Thanks for the addition!

@jacobperron jacobperron merged commit 9ae733a into ros2:master Aug 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants