Skip to content

Commit

Permalink
Add ament_xmllint test by default to ament_python packages. (#957)
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Lalancette <[email protected]>
  • Loading branch information
clalancette authored Dec 28, 2024
1 parent e20d2c6 commit 9f8e545
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
5 changes: 5 additions & 0 deletions ros2pkg/ros2pkg/api/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,11 @@ def populate_ament_python(package, package_directory, source_directory, python_n
test_directory,
'test_pep257.py',
{})
_create_template_file('ament_python',
'test_xmllint.py.em',
test_directory,
'test_xmllint.py',
{})


def populate_python_node(package, source_directory, python_node_name):
Expand Down
23 changes: 23 additions & 0 deletions ros2pkg/ros2pkg/resource/ament_python/test_xmllint.py.em
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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.

from ament_xmllint.main import main
import pytest


@@pytest.mark.linter
@@pytest.mark.xmllint
def test_xmllint() -> None:
rc = main(argv=[])
assert rc == 0, 'Found code style errors / warnings'
2 changes: 1 addition & 1 deletion ros2pkg/ros2pkg/verb/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def main(self, *, args):
test_dependencies = ['ament_lint_auto', 'ament_lint_common']
if args.build_type == 'ament_python':
test_dependencies = ['ament_copyright', 'ament_flake8', 'ament_pep257',
'python3-pytest']
'ament_xmllint', 'python3-pytest']

if args.build_type == 'ament_python' and args.package_name == 'test':
# If the package name is 'test', there will be a conflict between
Expand Down

0 comments on commit 9f8e545

Please sign in to comment.