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

Several "settings" fixes and plugin to allow setting/modifying config file paths #3033

Merged
merged 6 commits into from
Feb 12, 2019

Conversation

ldoktor
Copy link
Contributor

@ldoktor ldoktor commented Feb 11, 2019

This PR fixes several issues in "avocado.core.settings" and on top adds plugin to allow to extend/modify the list of config-file locations to be parsed into settings. This plugin is to be used by Avocado-vt (and hopefully other plugins will follow) to clearly define their config files.

v1: #2780
related: avocado-framework/avocado-vt#1142

Changes:

v2: Use ExtensionManager instead of EnabledExtensionManager
v2: New commit with style fixes
v2: Added documentation in "settings: Change the way config files are processed" and
    "Add support for SettingsPlugin".

Currently in-tree is evaluated based on presence of config files, but in
reallity the "settings.intree" used to get tests path. Let's use it to
check for in-tree detection, which should better correspond to how this
value is being used.

Signed-off-by: Lukáš Doktor <[email protected]>
When the intree config exists, it's the same resource as pkg config.
Let's only process the pkg config and use pkg_resources properly to list
the directory with extra config files.

Signed-off-by: Lukáš Doktor <[email protected]>
This docstring is a bit cryptic, let's makes it 100% clear it's only
used by unittests and the "--config" argument uses different approach.

Signed-off-by: Lukáš Doktor <[email protected]>
Originally we only processed files that existed and when they were read
we updated list of config locations and in case of no return list of
failed-to-read paths. Anyway the "config.read" function accepts list of
config files and returns list of successfully parsed files. Missing
files are automatically skipped and broken files raise exception, so
let's just simply create list of to-be-read files and feed it into the
"config.read" function.

As a result the list of not-read files actually works, still in this
version it's only displayed on "avocado config", where users can get
notion of all possible locations and in "avocado run" only parsed files
are displayed as it doesn't seem important enough to log them there to
me.

Signed-off-by: Lukáš Doktor <[email protected]>
With this implementations plugins will be able to modify the path list
for "avocado.core.settings". Mainly it should be used to register extra
configuration, but users should also be able to reorder/remove/modify
the path to default config files.

Signed-off-by: Lukáš Doktor <[email protected]>
Some pylint fixes and removal of not necessary import.

Signed-off-by: Lukáš Doktor <[email protected]>
@ldoktor
Copy link
Contributor Author

ldoktor commented Feb 12, 2019

Btw I do remember the travis failure from recursive. On py3.4 and py3.5 it sometimes discovered the tests in a wrong order. I know I suggested sorting them in selftests, but I don't remember the final decision. @clebergnu do you want me to add the sorting now as it is causing troubles?

Copy link
Contributor

@clebergnu clebergnu left a comment

Choose a reason for hiding this comment

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

@ldoktor I've rebased it locally, and checked all the commits. It LGTM, thanks.

@clebergnu clebergnu merged commit 49439bc into avocado-framework:master Feb 12, 2019
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