Path 1: 19 calls (0.58)

'/Users/andrehora/Documents/git/projects-pathspotter/pylint/tests/config/functional/toml/toml_with_enable.toml' (1) '/Users/andrehora/Documents/git/pr...

PosixPath (19)

(0, '') (19)

1def get_expected_output(
2    configuration_path: str | Path, user_specific_path: Path
3) -> tuple[int, str]:
4    """Get the expected output of a functional test."""
5    exit_code = 0
6    msg = (
7        "we expect a single file of the form 'filename.32.out' where 'filename' represents "
8        "the name of the configuration file, and '32' the expected error code."
9    )
10    possible_out_files = get_related_files(configuration_path, suffix_filter="out")
11    if len(possible_out_files) > 1:
12        logging.error(
13            "Too much .out files for %s %s.",
14            configuration_path,
15            msg,
16        )
17        return -1, "out file is broken"
18    if not possible_out_files:
19        # logging is helpful to see what the expected exit code is and why.
20        # The output of the program is checked during the test so printing
21        # messes with the result.
22        logging.info(".out file does not exists, so the expected exit code is 0")
23        return 0, ""
24    path = possible_out_files[0]
25    try:
26        exit_code = int(str(path.stem).rsplit(".", maxsplit=1)[-1])
27    except Exception as e:  # pylint: disable=broad-except
28        logging.error(
29            "Wrong format for .out file name for %s %s: %s",
30            configuration_path,
31            msg,
32            e,
33        )
34        return -1, "out file is broken"
35
36    output = get_expected_or_default(
37        configuration_path, suffix=f"{exit_code}.out", default=""
38    )
39    logging.info(
40        "Output exists for %s so the expected exit code is %s",
41        configuration_path,
42        exit_code,
43    )
44    return exit_code, output.format(
45        abspath=configuration_path,
46        relpath=Path(configuration_path).relative_to(user_specific_path),
47    )
            

Path 2: 12 calls (0.36)

'/Users/andrehora/Documents/git/projects-pathspotter/pylint/tests/config/functional/toml/toml_with_unknown_option.toml' (1) '/Users/andrehora/Document...

PosixPath (12)

(2, '************* Module /Users/andrehora/Documents/git/projects-pathspotter/pylint/tests/config/functional/toml/toml_with_unknown_option.toml\ntests...

1def get_expected_output(
2    configuration_path: str | Path, user_specific_path: Path
3) -> tuple[int, str]:
4    """Get the expected output of a functional test."""
5    exit_code = 0
6    msg = (
7        "we expect a single file of the form 'filename.32.out' where 'filename' represents "
8        "the name of the configuration file, and '32' the expected error code."
9    )
10    possible_out_files = get_related_files(configuration_path, suffix_filter="out")
11    if len(possible_out_files) > 1:
12        logging.error(
13            "Too much .out files for %s %s.",
14            configuration_path,
15            msg,
16        )
17        return -1, "out file is broken"
18    if not possible_out_files:
19        # logging is helpful to see what the expected exit code is and why.
20        # The output of the program is checked during the test so printing
21        # messes with the result.
22        logging.info(".out file does not exists, so the expected exit code is 0")
23        return 0, ""
24    path = possible_out_files[0]
25    try:
26        exit_code = int(str(path.stem).rsplit(".", maxsplit=1)[-1])
27    except Exception as e:  # pylint: disable=broad-except
28        logging.error(
29            "Wrong format for .out file name for %s %s: %s",
30            configuration_path,
31            msg,
32            e,
33        )
34        return -1, "out file is broken"
35
36    output = get_expected_or_default(
37        configuration_path, suffix=f"{exit_code}.out", default=""
38    )
39    logging.info(
40        "Output exists for %s so the expected exit code is %s",
41        configuration_path,
42        exit_code,
43    )
44    return exit_code, output.format(
45        abspath=configuration_path,
46        relpath=Path(configuration_path).relative_to(user_specific_path),
47    )
            

Path 3: 1 calls (0.03)

PosixPath (1)

PosixPath (1)

(-1, 'out file is broken') (1)

1def get_expected_output(
2    configuration_path: str | Path, user_specific_path: Path
3) -> tuple[int, str]:
4    """Get the expected output of a functional test."""
5    exit_code = 0
6    msg = (
7        "we expect a single file of the form 'filename.32.out' where 'filename' represents "
8        "the name of the configuration file, and '32' the expected error code."
9    )
10    possible_out_files = get_related_files(configuration_path, suffix_filter="out")
11    if len(possible_out_files) > 1:
12        logging.error(
13            "Too much .out files for %s %s.",
14            configuration_path,
15            msg,
16        )
17        return -1, "out file is broken"
18    if not possible_out_files:
19        # logging is helpful to see what the expected exit code is and why.
20        # The output of the program is checked during the test so printing
21        # messes with the result.
22        logging.info(".out file does not exists, so the expected exit code is 0")
23        return 0, ""
24    path = possible_out_files[0]
25    try:
26        exit_code = int(str(path.stem).rsplit(".", maxsplit=1)[-1])
27    except Exception as e:  # pylint: disable=broad-except
28        logging.error(
29            "Wrong format for .out file name for %s %s: %s",
30            configuration_path,
31            msg,
32            e,
33        )
34        return -1, "out file is broken"
35
36    output = get_expected_or_default(
37        configuration_path, suffix=f"{exit_code}.out", default=""
38    )
39    logging.info(
40        "Output exists for %s so the expected exit code is %s",
41        configuration_path,
42        exit_code,
43    )
44    return exit_code, output.format(
45        abspath=configuration_path,
46        relpath=Path(configuration_path).relative_to(user_specific_path),
47    )
            

Path 4: 1 calls (0.03)

PosixPath (1)

PosixPath (1)

(-1, 'out file is broken') (1)

ValueError (1)

1def get_expected_output(
2    configuration_path: str | Path, user_specific_path: Path
3) -> tuple[int, str]:
4    """Get the expected output of a functional test."""
5    exit_code = 0
6    msg = (
7        "we expect a single file of the form 'filename.32.out' where 'filename' represents "
8        "the name of the configuration file, and '32' the expected error code."
9    )
10    possible_out_files = get_related_files(configuration_path, suffix_filter="out")
11    if len(possible_out_files) > 1:
12        logging.error(
13            "Too much .out files for %s %s.",
14            configuration_path,
15            msg,
16        )
17        return -1, "out file is broken"
18    if not possible_out_files:
19        # logging is helpful to see what the expected exit code is and why.
20        # The output of the program is checked during the test so printing
21        # messes with the result.
22        logging.info(".out file does not exists, so the expected exit code is 0")
23        return 0, ""
24    path = possible_out_files[0]
25    try:
26        exit_code = int(str(path.stem).rsplit(".", maxsplit=1)[-1])
27    except Exception as e:  # pylint: disable=broad-except
28        logging.error(
29            "Wrong format for .out file name for %s %s: %s",
30            configuration_path,
31            msg,
32            e,
33        )
34        return -1, "out file is broken"
35
36    output = get_expected_or_default(
37        configuration_path, suffix=f"{exit_code}.out", default=""
38    )
39    logging.info(
40        "Output exists for %s so the expected exit code is %s",
41        configuration_path,
42        exit_code,
43    )
44    return exit_code, output.format(
45        abspath=configuration_path,
46        relpath=Path(configuration_path).relative_to(user_specific_path),
47    )