diff --git a/ament_index_python/ament_index_python/cli.py b/ament_index_python/ament_index_python/cli.py index 4fa8f67..775eeea 100644 --- a/ament_index_python/ament_index_python/cli.py +++ b/ament_index_python/ament_index_python/cli.py @@ -27,11 +27,11 @@ def main(argv: List[str] = sys.argv[1:]) -> Optional[str]: arg = parser.add_argument( 'resource_type', nargs='?', metavar='TYPE', help='The type of the resource') - arg.completer = resource_type_completer + arg.completer = resource_type_completer # type: ignore[attr-defined] arg = parser.add_argument( 'resource_name', nargs='?', metavar='NAME', help='The name of the resource') - arg.completer = resource_name_completer + arg.completer = resource_name_completer # type: ignore[attr-defined] try: from argcomplete import autocomplete diff --git a/ament_index_python/package.xml b/ament_index_python/package.xml index bc15f95..dc2646e 100644 --- a/ament_index_python/package.xml +++ b/ament_index_python/package.xml @@ -18,6 +18,7 @@ ament_copyright ament_flake8 ament_pep257 + ament_mypy python3-pytest diff --git a/ament_index_python/py.typed b/ament_index_python/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/ament_index_python/test/test_mypy.py b/ament_index_python/test/test_mypy.py new file mode 100644 index 0000000..e4f0247 --- /dev/null +++ b/ament_index_python/test/test_mypy.py @@ -0,0 +1,20 @@ +# Copyright 2024 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_mypy.main import main + + +def test_mypy() -> None: + rc = main(argv=['--exclude', 'test']) + assert rc == 0, 'Found code style errors / warnings' \ No newline at end of file