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
Simplify test_can_read_toml_env_variable
to work like other tests
#5284
Conversation
test_can_read_toml_env_variable
to work like other tests
Pull Request Test Coverage Report for Build 1441747249
💛 - Coveralls |
See initial intent in #3839 This permit to not use the OptionManagerMixin directly, which is problematic when it needs the function defined in Pylinter or other classes.
37390e2
to
3e87888
Compare
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.
Looks good (if two minor comments get resolved)!
Btw, I looked at #3839 and #4812 does not seem to test what is reported there imo. When I read that issue report I think the reporter implies that an environment variables is used within the config file. The test created in #4812 doesn't test a config file with env-variables inside the file, but rather when the file itself is a env-variable itself.
Let me know if you think I'm reading the initial report incorrectly, just thought I would let you know :)
tests/config/test_config.py
Outdated
|
||
def check_configuration_file_reader( | ||
runner: Run, | ||
expected_disabled=None, |
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.
This needs typing. I think it is Optional[Set[str]]
?
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.
Nice catch !
Readint this it seems it's the intended use case. But I don't think working env variable directly work. Doing this fail: diff --git a/tests/config/test_config.py b/tests/config/test_config.py
index 8ce5d9b4..bef53913 100644
--- a/tests/config/test_config.py
+++ b/tests/config/test_config.py
@@ -120,11 +120,12 @@ def test_can_read_toml_env_variable(tmp_path: Path) -> None:
"""
[tool.pylint."messages control"]
disable = "logging-not-lazy,logging-format-interpolation"
-jobs = "10"
+jobs = "${pylint_jobs}"
reports = "yes"
"""
)
env_var = "tmp_path_env"
os.environ[env_var] = str(config_file)
+ os.environ["pylint_jobs"] = "10"
run = get_runner_from_config_file(f"${env_var}")
check_configuration_file_reader(run)
|
243bb45
to
ecbfe80
Compare
ecbfe80
to
d85c094
Compare
Yeah, the test works for with the PR was trying to add but I wonder if that PR should have closed the issue. |
We could do it if someone open an issue. But it probably won't happen as we have a bazillion different ways to change options already (one of them being a global file, one of them is calling the command with the env variable directly it supersedes the config file value). |
Type of Changes
Description
See initial intent in #3839
This permit to not use the OptionManagerMixin directly, which is
problematic when it needs the function defined in Pylinter or
other classes.
Required for #4720