Skip to content

Commit

Permalink
Tools: ros2: Disable ament_flake, use black, enable networking
Browse files Browse the repository at this point in the history
* Everything else passes and we want DDS in CI running
* We're going to switch to black because autoformat
* Enforce formatting with black instead of flake8

Signed-off-by: Ryan Friedman <[email protected]>
  • Loading branch information
Ryanf55 committed Nov 25, 2023
1 parent ea23772 commit 66fc364
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
4 changes: 0 additions & 4 deletions Tools/autotest/sim_vehicle.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,16 +410,12 @@ def do_build(opts, frame_options):

if opts.enable_dds:
cmd_configure.append("--enable-dds")
if configure_target == 'sitl' and "--enable-networking" not in cmd_configure:
cmd_configure.append("--enable-networking")

if opts.disable_networking or configure_target != "sitl":
cmd_configure.append("--disable-networking")

if opts.enable_networking_tests:
cmd_configure.append("--enable-networking-tests")
if "--enable-networking" not in cmd_configure:
cmd_configure.append("--enable-networking")

pieces = [shlex.split(x) for x in opts.waf_configure_args]
for piece in pieces:
Expand Down
24 changes: 24 additions & 0 deletions Tools/ros2/ardupilot_dds_tests/test/test_black.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2015 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.

"""Test files are formatted with black"""
from ament_black.main import main
import pytest


@pytest.mark.ament_black
@pytest.mark.linter
def test_ament_black():
rc = main("help")
assert rc == 0, "ament-black python package not properly installed"
4 changes: 4 additions & 0 deletions Tools/ros2/ardupilot_sitl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()

# ament_black isn't supported in ament_lint_auto yet, so use pre-commit instead
# find_package(ament_cmake_black REQUIRED)
# ament_black()

# Add python tests.
find_package(ament_cmake_pytest REQUIRED)
set(_pytest_tests
Expand Down

0 comments on commit 66fc364

Please sign in to comment.