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

improve settings priority, #343

Merged
merged 4 commits into from Dec 29, 2018
Merged

improve settings priority, #343

merged 4 commits into from Dec 29, 2018

Conversation

@samuelcolvin
Copy link
Owner

@samuelcolvin samuelcolvin commented Dec 28, 2018

Change Summary

Improve documentation for settings priority and allow them to be more easily changed.

Related issue number

ref #341

Checklist

  • Unit tests for the changes exist
  • Tests pass on CI and coverage remains at 100%
  • Documentation reflects the changes
  • No performance deterioration (if applicable)
  • HISTORY.rst has been updated
    • if this is the first change since a release, please add a new section
    • include the issue number or this pull request number #<number>
    • if you're not a regular contributer please include your github username @whatever
@codecov
Copy link

@codecov codecov bot commented Dec 28, 2018

Codecov Report

Merging #343 into master will not change coverage.
The diff coverage is 100%.

@@          Coverage Diff          @@
##           master   #343   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          14     14           
  Lines        1820   1818    -2     
  Branches      356    356           
=====================================
- Hits         1820   1818    -2

s = Settings(__config_settings__=config, b='argument b', c='argument c')
assert s.a == 'config a'
assert s.b == 'argument b'
assert s.c == 'env setting c'
Copy link

@dbarrosop dbarrosop Dec 29, 2018

Not sure if I am misreading something but according to the docs the order of preference is class_defaults < env < arguments, however, your test is proving that class_defaults < arguments < env. I might be misreading this completely but my tests seem to confirm this.

Ok, just realized that your test case is testing changing the order + using the __config_settings__ trick, not the default case. So all is good and I managed to get it working exactly as I wanted, thanks a lot!

@samuelcolvin samuelcolvin merged commit 19320bf into master Dec 29, 2018
9 checks passed
@samuelcolvin samuelcolvin deleted the settings-priority branch Dec 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants