Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot set --test-result-base via mixin #47

Open
maspe36 opened this issue Sep 21, 2022 · 1 comment
Open

Cannot set --test-result-base via mixin #47

maspe36 opened this issue Sep 21, 2022 · 1 comment

Comments

@maspe36
Copy link

maspe36 commented Sep 21, 2022

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.

@cottsay
Copy link
Member

cottsay commented Feb 14, 2024

Hi!

This should have been resolved by colcon/colcon-mixin#37 which was released a while back. Can you confirm whether you're still experiencing the misbehavior?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants