-
Notifications
You must be signed in to change notification settings - Fork 13
Description
Steps to Reproduce
I'm trying to use a mixin for the test-result verb that sets --test-result-base argument. When running colcon test-result in my workspace, the mixin value for the argument is ignored and colcon exits early.
linux.mixin
{
"build": {
"linux": {
"build-base": linux/build,
"install-base": linux/install,
}
},
"test": {
"linux": {
"build-base": linux/build,
"install-base": linux/install,
"test-result-base": linux/build,
}
},
"test-result": {
"linux": {
"test-result-base": linux/build,
"verbose": true
}
}
}
I have tried with and without this argument in the test verb, as well as having this arg present in test but not in test-result. They both produce the error. Not 100% sure what the difference is but it doesn't seem to affect this issue. I see this PR and linked issue but it doesn't shed much light to me as to why this arg is different from test-results
defaults.yaml
{
"build": {
"symlink-install": true,
"mixin": ["linux"],
},
"test": {
"mixin": ["linux"],
},
"test-result": {
"mixin": [ "linux" ],
}
}My mixin is loaded correctly via colcon mixin
$ colcon mixin list
my_ws: file:///opt/mixins/index.yaml
- /home/docker/.colcon/mixin/my_ws/linux.mixin
And finally running colcon test-result
$ colcon test-result
usage: colcon test-result [-h] [--test-result-base TEST_RESULT_BASE] [--all] [--result-files-only] [--verbose] [--delete] [--delete-yes] [--mixin-files [FILE ...]]
[--mixin [mixin1 [mixin2 ...]]]
colcon test-result: error: argument --test-result-base: Path 'build' does not exist
If I set the value via my defaults.yaml everything works.
My Root Causing
Now I've done a bit of root causing and I believe the issue is because after parsing the defaults.yaml colcon will attempt to parse the current args before loading the mixin arg values.
This error is then being thrown because in this package, --test-result-base is registered with a custom type which throws an exception if a path doesn't exist
| type=_argparse_existing_dir, |
I did a search on github to see if any other colcon path arguments had this same issue and it seems like this one is unique
https://github.com/search?q=org%3Acolcon+type%3D_argparse_existing_dir%2C&type=code
It seems like the fix is to remove this type parameter when registering the type, but I'm not sure if test-result depends on that behavior somehow.