From 870817e99277449b3f99ddc09d142c8e3ff89ce4 Mon Sep 17 00:00:00 2001 From: Shingo Kitagawa Date: Thu, 11 Apr 2024 16:46:29 -0700 Subject: [PATCH 1/2] add test case --- tools/roslaunch/test/unit/test_roslaunch_rlutil.py | 5 +++++ .../test/xml/test-ignore-unset-args-arg-in-arg.launch | 7 +++++++ 2 files changed, 12 insertions(+) create mode 100644 tools/roslaunch/test/xml/test-ignore-unset-args-arg-in-arg.launch diff --git a/tools/roslaunch/test/unit/test_roslaunch_rlutil.py b/tools/roslaunch/test/unit/test_roslaunch_rlutil.py index c75d0d7312..067d15bf3f 100644 --- a/tools/roslaunch/test/unit/test_roslaunch_rlutil.py +++ b/tools/roslaunch/test/unit/test_roslaunch_rlutil.py @@ -94,3 +94,8 @@ def test_check_roslaunch(self): filename = os.path.join(get_test_path(), 'test', 'xml', 'test-ignore-unset-args.launch') error_msg = roslaunch.rlutil.check_roslaunch(filename, ignore_unset_args=True) assert error_msg is None + + def test_check_roslaunch_arg_in_arg(self): + filename = os.path.join(get_test_path(), 'test', 'xml', 'test-ignore-unset-args-arg-in-arg.launch') + error_msg = roslaunch.rlutil.check_roslaunch(filename, ignore_unset_args=True) + assert error_msg is None diff --git a/tools/roslaunch/test/xml/test-ignore-unset-args-arg-in-arg.launch b/tools/roslaunch/test/xml/test-ignore-unset-args-arg-in-arg.launch new file mode 100644 index 0000000000..d80f0fc179 --- /dev/null +++ b/tools/roslaunch/test/xml/test-ignore-unset-args-arg-in-arg.launch @@ -0,0 +1,7 @@ + + + + + + + From 5b5f45dd8323c1aa0e376f5fdc9db02b68704879 Mon Sep 17 00:00:00 2001 From: Shingo Kitagawa Date: Thu, 11 Apr 2024 16:47:18 -0700 Subject: [PATCH 2/2] raise argexception in _arg_tag --- tools/roslaunch/src/roslaunch/xmlloader.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/roslaunch/src/roslaunch/xmlloader.py b/tools/roslaunch/src/roslaunch/xmlloader.py index df1b26327b..e959506e4a 100644 --- a/tools/roslaunch/src/roslaunch/xmlloader.py +++ b/tools/roslaunch/src/roslaunch/xmlloader.py @@ -302,8 +302,8 @@ def _arg_tag(self, tag, context, ros_config, verbose=True): context.add_arg(name, value=value, default=default, doc=doc) - except substitution_args.ArgException as e: - raise XmlParseException( + except ArgException as e: + raise ArgException( "arg '%s' is not defined. \n\nArg xml is %s"%(e, tag.toxml())) except ResourceNotFound as e: raise ResourceNotFound(