Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com>
  • Loading branch information
Pierre-Sassoulas and DanielNoord committed Nov 11, 2021
1 parent cc932f5 commit bea964b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions pylint/testutils/configuration_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE

"""Utility function for configuration testing."""
"""Utility functions for configuration testing."""
import copy
import json
import logging
Expand Down Expand Up @@ -65,7 +65,7 @@ def get_expected_output(configuration_path: str) -> Tuple[int, str]:
"""Get the expected output of a functional test."""

def get_relative_path(path: str) -> str:
"""Get the relative path we want without user specific information"""
"""Get the relative path we want without the user specific path"""
return path.replace(USER_SPECIFIC, "")[1:]

output = get_expected_or_default(configuration_path, suffix="out", default="")
Expand All @@ -88,10 +88,10 @@ def run_using_a_configuration_file(
"""Simulate a run with a configuration without really launching the checks."""
configuration_path = str(configuration_path)
args = ["--rcfile", configuration_path, file_to_lint]
# If we used `pytest.raises(SystemExit)`, the `runner` variable
# We do not capture the `SystemExit` as then the `runner` variable
# would not be accessible outside the `with` block.
with unittest.mock.patch("sys.exit") as mocked_exit:
# Do not actually run checks, that could be slow. Do not mock
# Do not actually run checks, that could be slow. We don't mock
# `Pylinter.check`: it calls `Pylinter.initialize` which is
# needed to properly set up messages inclusion/exclusion
# in `_msg_states`, used by `is_message_enabled`.
Expand Down
8 changes: 4 additions & 4 deletions tests/config/test_functional_config_loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
You must also define a ``regression_list_crash.result.json`` if you want to check the parsed configuration.
This file will be loaded as a dict and will override the default value of the default pylint
configuration. If you need to append or remove a value use the special key ``"functional_append"``
and ``"functional_remove":``. Check the existing code for example.
and ``"functional_remove":``. Check the existing code for examples.
"""

# pylint: disable=redefined-outer-name
Expand All @@ -34,9 +34,9 @@

HERE = Path(__file__).parent
FUNCTIONAL_DIR = HERE / "functional"
# We use string then recast to path so we can use -k in pytest otherwise
# we get 'configuration_path0' as a test name. Relative to the functional
# directory because otherwise the string is very lengthy
# We use string then recast to path so we can use -k in pytest.
# Otherwise we get 'configuration_path0' as a test name. The path is relative to the functional
# directory because otherwise the string would be very lengthy.
CONFIGURATION_PATHS = [
str(path.relative_to(FUNCTIONAL_DIR))
for ext in ("toml", "ini", "cfg")
Expand Down

0 comments on commit bea964b

Please sign in to comment.