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

#6597 Add optional value for get_safe #6739

Merged
merged 2 commits into from Mar 27, 2020

Conversation

uilianries
Copy link
Member

@uilianries uilianries commented Mar 25, 2020

Changelog: Feature: Make settings.get_safe and options.get_safe accept a default value.
Docs: conan-io/docs#1631

closes #6597

  • Refer to the issue that supports this Pull Request.
  • If the issue has missing info, explain the purpose/use case/pain/need that covers this Pull Request.
  • I've read the Contributing guide.
  • I've followed the PEP8 style guides for Python code.
  • I've opened another PR in the Conan docs repo to the develop branch, documenting this one.

Note: By default this PR will skip the slower tests and will use a limited set of python versions. Check here how to increase the testing level by writing some tags in the current PR body text.

Signed-off-by: Uilian Ries <uilianries@gmail.com>
@@ -100,6 +100,9 @@ def test_get_safe(self):
self.assertEqual(settings.os, "Windows")
self.assertEqual(settings.get_safe("compiler.version"), None)
self.assertEqual(settings.get_safe("build_type"), None)
self.assertEqual("Release", settings.get_safe("build_type", "Release"))
self.assertEqual(False, settings.get_safe("build_type", False))
self.assertEqual("Windows", settings.get_safe("os", "Linux"))
Copy link
Member Author

@uilianries uilianries Mar 25, 2020

Choose a reason for hiding this comment

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

about assertEqual signature, the correct form is (expected, current). Yeah, it sounds like yoda conditions ...

@memsharded
Copy link
Member

@memsharded memsharded commented Mar 25, 2020

@jgsogo seems low risk, might be added to 1.24 if you think so.

@memsharded memsharded added this to the 1.24 milestone Mar 25, 2020
Copy link
Member

@jgsogo jgsogo left a comment

Just a minor suggestion.

Yes, I'm sure we can merge it, it shouldn't break anyone

conans/model/options.py Outdated Show resolved Hide resolved
Co-Authored-By: Javier G. Sogo <jgsogo@gmail.com>
jgsogo
jgsogo approved these changes Mar 27, 2020
@jgsogo jgsogo merged commit 8e2cac4 into conan-io:develop Mar 27, 2020
2 checks passed
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.

3 participants