Example #1
0
def test_mypy():
    # TODO: when ament_mypy is officially released, remove this check and move import to the top
    # of the file. Until then, we still use it internally as developers.
    try:
        from ament_mypy.main import main
        assert main(argv=[]) == 0, 'Found errors'
    except ImportError:
        pass
Example #2
0
def test_mypy():
    try:
        import importlib.resources as _  # noqa: F401
    except ModuleNotFoundError:
        # The importlib_resources package is a backport of the importlib.resources module
        # from Python 3.9. The 'policy' module of this project first tries to import from
        # importlib.resources, then falls back to the backport package.
        # There is a bug in mypy that manifests when this try/except import pattern is
        # used: https://github.com/python/mypy/issues/1153
        pytest.skip('This platform does not support mypy checking of importlib properly')
    assert main(argv=[]) == 0, 'Found errors'
Example #3
0
def test_mypy():
    # TODO: when ament_mypy is officially released, remove this check and move import to the top
    # of the file. Until then, we still use it internally as developers.
    try:
        from ament_mypy.main import main
        config_path = Path(__file__).parent / 'config' / 'mypy.ini'
        print(config_path.resolve())
        rc = main(argv=[
            'launch_ros_sandbox', '--config',
            str(config_path.resolve())
        ])
        assert rc == 0, 'Found code style errors / warnings'
    except ImportError:
        pass
Example #4
0
def test_mypy():
    """Perform mypy static type analysis."""
    rc = main([])
    assert rc == 0, 'Found code style errors / warnings'
Example #5
0
def test_mypy():
    assert main(argv=[]) == 0, 'Found errors'
Example #6
0
def test_mypy():
    rc = main(argv=['--exclude', 'test'])
    assert rc == 0, 'Found code style errors / warnings'