diff options
-rw-r--r-- | pylint/testutils/configuration_test.py | 7 | ||||
-rw-r--r-- | tests/config/test_functional_config_loading.py | 5 |
2 files changed, 8 insertions, 4 deletions
diff --git a/pylint/testutils/configuration_test.py b/pylint/testutils/configuration_test.py index 2fac8f1c1..2a33d9388 100644 --- a/pylint/testutils/configuration_test.py +++ b/pylint/testutils/configuration_test.py @@ -12,7 +12,6 @@ from unittest.mock import Mock from pylint.lint import Run -USER_SPECIFIC_PATH = Path(__file__).parent.parent.parent # We use Any in this typing because the configuration contains real objects and constants # that could be a lot of things. ConfigurationValue = Any @@ -71,7 +70,9 @@ def get_expected_configuration( return result -def get_expected_output(configuration_path: str) -> Tuple[int, str]: +def get_expected_output( + configuration_path: str, user_specific_path: Path +) -> Tuple[int, str]: """Get the expected output of a functional test.""" output = get_expected_or_default(configuration_path, suffix="out", default="") if output: @@ -87,7 +88,7 @@ def get_expected_output(configuration_path: str) -> Tuple[int, str]: exit_code = 0 return exit_code, output.format( abspath=configuration_path, - relpath=Path(configuration_path).relative_to(USER_SPECIFIC_PATH), + relpath=Path(configuration_path).relative_to(user_specific_path), ) diff --git a/tests/config/test_functional_config_loading.py b/tests/config/test_functional_config_loading.py index 452d7cc90..6ee86d679 100644 --- a/tests/config/test_functional_config_loading.py +++ b/tests/config/test_functional_config_loading.py @@ -32,6 +32,7 @@ from pylint.testutils.configuration_test import ( ) HERE = Path(__file__).parent +USER_SPECIFIC_PATH = HERE.parent.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. The path is relative to the functional @@ -71,7 +72,9 @@ def test_functional_config_loading( caplog.set_level(logging.INFO) configuration_path = str(FUNCTIONAL_DIR / configuration_path) msg = f"Wrong result with configuration {configuration_path}" - expected_code, expected_output = get_expected_output(configuration_path) + expected_code, expected_output = get_expected_output( + configuration_path, USER_SPECIFIC_PATH + ) expected_loaded_configuration = get_expected_configuration( configuration_path, default_configuration ) |