Add mypy tests through ament_mypy

Signed-off-by: Christophe Bedard <bedard.christophe@gmail.com>
This commit is contained in:
Christophe Bedard 2020-03-01 11:50:31 -05:00
parent aa59950fe2
commit 9450bfeea9
15 changed files with 117 additions and 23 deletions

View file

@ -0,0 +1,22 @@
# Copyright 2019 Canonical Ltd
#
# 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
import pytest
@pytest.mark.mypy
@pytest.mark.linter
def test_mypy():
assert main(argv=[]) == 0, 'Found errors'

View file

@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from typing import List
import unittest
from tracetools_launch.action import Trace
@ -26,7 +27,7 @@ class TestTraceAction(unittest.TestCase):
)
def test_has_profiling_events(self) -> None:
events_lists_match = [
events_lists_match: List[List[str]] = [
[
'lttng_ust_cyg_profile_fast:func_entry',
'hashtag:yopo',
@ -37,7 +38,7 @@ class TestTraceAction(unittest.TestCase):
'lttng_ust_cyg_profile:func_exit',
],
]
events_lists_no_match = [
events_lists_no_match: List[List[str]] = [
[
'lttng_ust_statedump:bin_info',
'ros2:event',
@ -50,7 +51,7 @@ class TestTraceAction(unittest.TestCase):
self.assertFalse(Trace.has_profiling_events(events))
def test_has_ust_memory_events(self) -> None:
events_lists_match = [
events_lists_match: List[List[str]] = [
[
'hashtag:yopo',
'lttng_ust_libc:malloc',
@ -60,7 +61,7 @@ class TestTraceAction(unittest.TestCase):
'lttng_ust_libc:still_a_match',
],
]
events_lists_no_match = [
events_lists_no_match: List[List[str]] = [
[],
[
'my_random:event',