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
Handle unknown statement while parsing profile. Fixes #6931 #7577
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix looks good. Please check the comment about the exception.
It would be great to include a test that covers this case. Do you think you could manage to add it? profile_loader_test.py
seems a good place. Ask for help if need it, we could contribute the test if you prefer.
conans/client/profile_loader.py
Outdated
try: | ||
name, value = line.split("=", 1) | ||
except ValueError as error: | ||
raise ConanParsingError("Error while parsing line %i: '%s'" % (counter, line)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's throw a generic ConanException
. New exceptions will be introduced from now on, only if it is going to be captured and processed somewhere else. Let's keep it simple.
I hadn't check the CI, please check: https://conan-ci.jfrog.info/blue/organizations/jenkins/ConanTestSuite/detail/PR-7577/1/pipeline One of the test was producing a different output, the test can be changed (and also adding a new one that valides the |
Ok, I added the requested changes except the tests. I'm trying to figure out what test I broke because, when I run FAILED (SKIP=250, errors=30, failures=2) Even if I run those tests from |
Yes, setting up the whole environment might be a bit complicated, and a docker image will only partially help, because there might be easily tests failing in other platforms, other python versions, etc. Typically having a look at our CI and running those failing tests manually (with In your case: https://conan-ci.jfrog.info/blue/organizations/jenkins/ConanTestSuite/detail/PR-7577/2/pipeline, so probably running |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, thanks!
Changelog: Bugfix: Provide a more descriptive error when an unknown statement is added to a profile
Docs: omit
Closes: #6931
Tested with the example provided in the examples repository
I replaced the first line:
By:
When running
conan
before this change, the command output is:After this change: