Skip to content

Commit

Permalink
add ament_mypy unit test
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Carlstrom <rmc@carlstrom.com>
  • Loading branch information
InvincibleRMC committed Jul 23, 2024
1 parent 186831a commit 6d085a4
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ament_index_python/ament_index_python/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions ament_index_python/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<test_depend>ament_copyright</test_depend>
<test_depend>ament_flake8</test_depend>
<test_depend>ament_pep257</test_depend>
<test_depend>ament_mypy</test_depend>
<test_depend>python3-pytest</test_depend>

<export>
Expand Down
Empty file added ament_index_python/py.typed
Empty file.
20 changes: 20 additions & 0 deletions ament_index_python/test/test_mypy.py
Original file line number Diff line number Diff line change
@@ -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'

0 comments on commit 6d085a4

Please sign in to comment.