-
Notifications
You must be signed in to change notification settings - Fork 602
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
Enable support for non default config section #338
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.
The looks like a good idea. But I think the docs should make clear that the default section is always loaded, and the other given section only updates the config from the default section. This feature in general should probably also be mentioned in doc/configuration.rst
.
Documentation have been updated. |
@felixdivo and @hardbyte do you think that |
can/util.py
Outdated
@@ -133,6 +134,10 @@ def load_config(path=None, config=None): | |||
A dict which may set the 'interface', and/or the 'channel', or neither. | |||
It may set other values that are passed through. | |||
|
|||
:param section: | |||
name of the section in config file to read configuration from. | |||
Default (None) is to use the 'default' section |
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.
The "(None)" is not required any more.
The only thing missing now are tests. I think |
@felixdivo, I will add few tests. |
@felixdivo, I have added tests to cover this newly added feature. This should be enough for this pull request. However, we should probably add more tests for |
Yes, you are right. See #345. Thanks for the tests for this new feature. |
I would merge this if the tests ran. @hardbyte Do you think this is a good addition to the library? |
I will fix the code and test soon. |
Codecov Report
@@ Coverage Diff @@
## develop #338 +/- ##
==========================================
+ Coverage 58.52% 58.6% +0.07%
==========================================
Files 54 54
Lines 4207 4215 +8
==========================================
+ Hits 2462 2470 +8
Misses 1745 1745
Continue to review full report at Codecov.
|
|
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.
Hey @pierreluctg this looks like a great addition. Personally I'd name it straight config
or perhaps context
instead of config_section
- the section seems more like an internal detail where the user really just wants to say "use the configuration HS1
or HS2
".
👍 😄 |
@hardbyte I do agree that I have renamed |
This change allow to use other config sections.
can.ini