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

Nicer error in the compatibility plugin with custom compilers #13328

Merged

Conversation

AbrilRBS
Copy link
Member

@AbrilRBS AbrilRBS commented Mar 5, 2023

Changelog: Bugfix: Nicer error in the compatibility plugin with custom compilers.
Docs: Omit

After seeing #13325, figured I'd improve the UX of the raised error. My first idea was to make the function return an empty list if the compiler was not known, but that would change current behaviour and so I decided to at least improve the generated exception, happy to discuss if going that way would work or not (Mostly so I get to learn about it a bit more :))

Also, I noticed that the plugin code itself is not currently directly tested and we might want to look into improving that, but I tried and got hit a wall because of how the function is defined in the code, it makes it hard to test. We could get it to run by running the same code that the test_migrations code does, but I was not able to come up with a test that exercised the compatibility feature, so any help is welcomed!

@memsharded
Copy link
Member

After seeing #13325, figured I'd improve the UX of the raised error. My first idea was to make the function return an empty list if the compiler was not known, but that would change current behaviour and so I decided to at least improve the generated exception, happy to discuss if going that way would work or not (Mostly so I get to learn about it a bit more :))

Yes, definitely a better error until we discuss what would be a better default (taking into account that there will be users adding their own compilers to settings.yml, that would hit this error).

Also, I noticed that the plugin code itself is not currently directly tested and we might want to look into improving that, but I tried and got hit a wall because of how the function is defined in the code, it makes it hard to test. We could get it to run by running the same code that the test_migrations code does, but I was not able to come up with a test that exercised the compatibility feature, so any help is welcomed!

I think there are tests like TestCacheCompatibles that validate behavior of compatibility.py, isn't that enough?

Copy link
Member

@memsharded memsharded left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a unit test would be great.

@AbrilRBS
Copy link
Member Author

AbrilRBS commented Mar 8, 2023

Done, I have added a case where it all works just to make sure

@memsharded memsharded merged commit 5019d08 into conan-io:develop2 Mar 8, 2023
@AbrilRBS AbrilRBS deleted the rr/cppstd-better-error-unknown-compiler branch March 8, 2023 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants