Skip to content

Commit

Permalink
Test for metapackage with format 2 (#243)
Browse files Browse the repository at this point in the history
Produce different warning message for dependencies in format 1 (has to have `run_depends`) and formats 2 and 2 (`exec_depends`)
  • Loading branch information
Nickolaim authored and dirk-thomas committed Nov 17, 2018
1 parent dca2ea3 commit efcc438
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/catkin_pkg/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,8 @@ def validate(self, warnings=None):
new_warnings.append('Metapackage "%s" must buildtool_depend on catkin.' % self.name)
if self.has_invalid_metapackage_dependencies():
new_warnings.append('Metapackage "%s" should not have other dependencies besides a '
'buildtool_depend on catkin and run_depends.' % self.name)
'buildtool_depend on catkin and %s.' %
(self.name, 'run_depends' if self.package_format == 1 else 'exec_depends'))

for warning in new_warnings:
if warnings is None:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cmake_minimum_required(VERSION 2.8.3)
project(valid_metapackage_format2)
find_package(catkin REQUIRED)
catkin_metapackage()
17 changes: 17 additions & 0 deletions test/data/metapackages/valid_metapackage_format2/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml-model href="http://download.ros.org/schema/package_format2.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="2">
<name>valid_metapackage_format2</name>
<version>0.1.0</version>
<description>valid_metapackage</description>

<maintainer email="user@todo.todo">user</maintainer>
<license>BSD</license>
<buildtool_depend>catkin</buildtool_depend>

<exec_depend>foo</exec_depend>

<export>
<metapackage/>
</export>

</package>
3 changes: 2 additions & 1 deletion test/test_metapackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
'no_cmake': [InvalidMetapackage, 'No CMakeLists.txt', None],
'no_metapackage_tag': [InvalidMetapackage, 'No <metapackage/> tag in <export>', None],
'NonConformingName': [None, None, None],
'valid_metapackage': [None, None, None]
'valid_metapackage': [None, None, None],
'valid_metapackage_format2': [None, None, None],
}

test_expected_warnings = [
Expand Down

0 comments on commit efcc438

Please sign in to comment.