Skip to content

Installing latest flake8 breaks ament_flake8 on humble: ValueError: 'string' is not callable #545

@Ryanf55

Description

@Ryanf55

Installing latest flake8 breaks ament_flake8. While flake8 3.7.9 works, upgrading to the latest of 7.2.0 causes tests in ros2/launch on humble branch, commit b4a2c06a41a9c34435548180221fdb7429b539c1 to fail.

Found in ArduPilot/ardupilot#30369 (comment)

Perhaps this is an unsupported combo?

colcon test --packages-select launch --pytest-args " -k" " test_flake8" " -v" --event-handlers=console_cohesion+
Starting >>> launch  
--- output: launch                   
============================= test session starts ==============================
platform linux -- Python 3.10.12, pytest-6.2.5, py-1.10.0, pluggy-0.13.0 -- /usr/bin/python3
cachedir: /home/ryan/Dev/ros2_ws/src/launch/build/launch/.pytest_cache
rootdir: /home/ryan/Dev/ros2_ws/src/launch/launch, configfile: pytest.ini
plugins: launch-pytest-1.0.7, ament-xmllint-0.12.11, ament-black-0.2.6, ament-lint-0.12.11, ament-copyright-0.12.11, launch-testing-ros-0.19.8, launch-testing-1.0.7, ament-mypy-0.12.11, ament-flake8-0.12.11, ament-pep257-0.12.11, anyio-4.6.2.post1, mock-3.6.1, cov-3.0.0, colcon-core-0.18.4, timeout-2.1.0
collecting ... 
collected 242 items / 241 deselected / 1 selected                              

test/test_flake8.py::test_flake8 FAILED                                  [100%]

=================================== FAILURES ===================================
_________________________________ test_flake8 __________________________________
test/test_flake8.py:22: in test_flake8
    rc, errors = main_with_errors(argv=[])
/opt/ros/humble/lib/python3.10/site-packages/ament_flake8/main.py:88: in main_with_errors
    report = generate_flake8_report(
/opt/ros/humble/lib/python3.10/site-packages/ament_flake8/main.py:267: in generate_flake8_report
    style = get_flake8_style_guide(flake8_argv)
/opt/ros/humble/lib/python3.10/site-packages/ament_flake8/main.py:186: in get_flake8_style_guide
    application.plugins, application.options = parse_args(argv)
/home/ryan/.local/lib/python3.10/site-packages/flake8/options/parse_args.py:51: in parse_args
    option_manager.register_plugins(plugins)
/home/ryan/.local/lib/python3.10/site-packages/flake8/options/manager.py:259: in register_plugins
    add_options(self)
/usr/lib/python3/dist-packages/flake8_import_order/flake8_linter.py:44: in add_options
    register_opt(
/usr/lib/python3/dist-packages/flake8_import_order/flake8_linter.py:98: in register_opt
    parser.add_option(*args, **kwargs)
/home/ryan/.local/lib/python3.10/site-packages/flake8/options/manager.py:281: in add_option
    self._current_group.add_argument(*option_args, **option_kwargs)
/usr/lib/python3.10/argparse.py:1447: in add_argument
=============================== warnings summary ===============================
test/test_flake8.py::test_flake8
  Warning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html

test/test_flake8.py::test_flake8
  Warning: Deprecated call to `pkg_resources.declare_namespace('mpl_toolkits')`.
  Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages

-- Docs: https://docs.pytest.org/en/stable/warnings.html
    raise ValueError('%r is not callable' % (type_func,))
E   ValueError: 'string' is not callable
- generated xml file: /home/ryan/Dev/ros2_ws/src/launch/build/launch/pytest.xml -
=========================== short test summary info ============================
FAILED test/test_flake8.py::test_flake8 - ValueError: 'string' is not callable
================ 1 failed, 241 deselected, 2 warnings in 0.52s =================
---
--- stderr: launch
=============================== warnings summary ===============================
test/test_flake8.py::test_flake8
  Warning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html

test/test_flake8.py::test_flake8
  Warning: Deprecated call to `pkg_resources.declare_namespace('mpl_toolkits')`.
  Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages

-- Docs: https://docs.pytest.org/en/stable/warnings.html
---
Finished <<< launch [0.84s]	[ with test failures ]

Summary: 1 package finished [0.92s]
  1 package had stderr output: launch
  1 package had test failures: launch

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions