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

Create a framework of functional tests for configuration files #5287

Merged
merged 23 commits into from Nov 12, 2021

Conversation

Pierre-Sassoulas
Copy link
Member

Type of Changes

Type
✨ New feature
🔨 Refactoring
📜 Docs

Description

This create a framework for configuration testing. Also migrate three standard unittest to the new framework for testing. Done to help with #4720.

@Pierre-Sassoulas Pierre-Sassoulas added Configuration Related to configuration Maintenance Discussion or action around maintaining pylint or the dev workflow labels Nov 10, 2021
@Pierre-Sassoulas Pierre-Sassoulas added this to the 2.12.0 milestone Nov 10, 2021
@coveralls
Copy link

coveralls commented Nov 10, 2021

Pull Request Test Coverage Report for Build 1454620578

  • 61 of 61 (100.0%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.04%) to 93.402%

Totals Coverage Status
Change from base Build 1453766788: 0.04%
Covered Lines: 13873
Relevant Lines: 14853

💛 - Coveralls

@Pierre-Sassoulas Pierre-Sassoulas force-pushed the add-functional-tests-for-configuration branch from c82225f to bf7f703 Compare November 10, 2021 17:21
Copy link
Collaborator

@DanielNoord DanielNoord left a comment

Choose a reason for hiding this comment

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

Great work! I think the functional_append and functional_remove and not the easiest to understand for new contributors, but they probably also shouldn't need to mess with it too much.

Left some comments here and there but in general this seems quite polished!

pylint/testutils/configuration_test.py Outdated Show resolved Hide resolved
pylint/testutils/configuration_test.py Outdated Show resolved Hide resolved
pylint/testutils/configuration_test.py Show resolved Hide resolved
pylint/testutils/configuration_test.py Outdated Show resolved Hide resolved
pylint/testutils/configuration_test.py Outdated Show resolved Hide resolved
tests/config/test_functional_config_loading.py Outdated Show resolved Hide resolved
tests/config/test_functional_config_loading.py Outdated Show resolved Hide resolved
tests/config/test_functional_config_loading.py Outdated Show resolved Hide resolved
tests/config/test_functional_config_loading.py Outdated Show resolved Hide resolved
pylint/testutils/configuration_test.py Show resolved Hide resolved
Copy link
Member Author

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

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

Should be good to go review again 😄

Copy link
Collaborator

@DanielNoord DanielNoord left a comment

Choose a reason for hiding this comment

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

Minor comments here and there.

Should we also test a pylintrc without any extension in this test framework?

pylint/testutils/configuration_test.py Outdated Show resolved Hide resolved
pylint/testutils/configuration_test.py Outdated Show resolved Hide resolved
pylint/testutils/configuration_test.py Show resolved Hide resolved
pylint/config/option_manager_mixin.py Outdated Show resolved Hide resolved
tests/config/test_functional_config_loading.py Outdated Show resolved Hide resolved
tests/config/test_functional_config_loading.py Outdated Show resolved Hide resolved
@Pierre-Sassoulas
Copy link
Member Author

Should we also test a pylintrc without any extension in this test framework?

Pylintrc is an ini file, I think the file name itself does not matter a lot. (The 'find the conf file' logic is handled elsewhere)

@Pierre-Sassoulas Pierre-Sassoulas force-pushed the add-functional-tests-for-configuration branch from 3895bd8 to 10135bb Compare November 12, 2021 17:00
pylint/config/option_manager_mixin.py Outdated Show resolved Hide resolved
Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com>
@Pierre-Sassoulas Pierre-Sassoulas merged commit c62738b into main Nov 12, 2021
@Pierre-Sassoulas Pierre-Sassoulas deleted the add-functional-tests-for-configuration branch November 12, 2021 21:19
@DanielNoord
Copy link
Collaborator

@Pierre-Sassoulas Did you test this with tox? The test break for me locally when using tox. pytest works fine.

@Pierre-Sassoulas
Copy link
Member Author

No I'm using only pytest but I thought github action used tox. Let me check.

@Pierre-Sassoulas
Copy link
Member Author

See #5301

@@ -271,6 +271,7 @@ def read_config_file(self, config_file=None, verbose=None):

use_config_file = config_file and os.path.exists(config_file)
if use_config_file:
self.set_current_module(config_file)
Copy link
Collaborator

Choose a reason for hiding this comment

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

@Pierre-Sassoulas Why is this necessary? Does this add anything other than allowing the test framework to function?

Ran into this while working on argparse.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it's setting the file that the add_message will display if we add a message later. I.E. [relpath}:1:0: E0013: later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Configuration Related to configuration Maintenance Discussion or action around maintaining pylint or the dev workflow
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants