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

Fix user specific path in functional conf tests for tox #5301

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions pylint/testutils/configuration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

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
Expand Down Expand Up @@ -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:
Expand All @@ -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),
)


Expand Down
5 changes: 4 additions & 1 deletion tests/config/test_functional_config_loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
)

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
Expand Down Expand Up @@ -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
)
Expand Down