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
Conversation
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' |
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.
How does this innovation work?
Does it just test all source .py files in the parent package the test file is located under?
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.
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 = ( |
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.
Is this change relevant, and if so how?
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.
It allows mypy to determine the type without us needing to add it manually.
Edit: re-triggered now that ament/ament_lint#182 is merged |
Thanks for the addition! |
This uses the newly-added ament_mypy package.