Skip to content

Commit

Permalink
Separate the get_relative_path function for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Sassoulas committed Nov 12, 2021
1 parent c166b28 commit 93dc0bc
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pylint/testutils/configuration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ def get_expected_configuration(
return result


def get_expected_output(configuration_path: str) -> Tuple[int, str]:
"""Get the expected output of a functional test."""
def get_relative_path(path: str, user_specific_path: str = USER_SPECIFIC_PATH) -> str:
"""Get the relative path we want without the user specific path"""
# [1:] is to remove the opening '/'
return path.split(user_specific_path)[1][1:]

def get_relative_path(path: str) -> str:
"""Get the relative path we want without the user specific path"""
# [1:] is to remove the opening '/'
return path.split(USER_SPECIFIC_PATH)[1][1:]

def get_expected_output(configuration_path: str) -> Tuple[int, str]:
"""Get the expected output of a functional test."""
output = get_expected_or_default(configuration_path, suffix="out", default="")
if output:
# logging is helpful to see what the expected exit code is and why.
Expand All @@ -91,7 +91,7 @@ def get_relative_path(path: str) -> str:
else:
logging.info(".out file does not exists, so the expected exit code is 0")
exit_code = 0
relpath = get_relative_path(configuration_path)
relpath = get_relative_path(configuration_path, USER_SPECIFIC_PATH)
return exit_code, output.format(abspath=configuration_path, relpath=relpath)


Expand Down

0 comments on commit 93dc0bc

Please sign in to comment.