third_party.pylibs.pylint.src/tests/testutils/test_configuration_test.py
Pierre Sassoulas ec4a3f7f1e Add a pre-commit hook to check the copyright notice
Fix the existing file so they have a notice.
No header for setup.py or examples or doc
2022-03-24 13:06:15 +01:00

28 lines
1.1 KiB
Python

# 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
# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
import logging
from pathlib import Path
from pytest import LogCaptureFixture
from pylint.testutils.configuration_test import get_expected_output
HERE = Path(__file__).parent
USER_SPECIFIC_PATH = HERE.parent.parent
DATA_DIRECTORY = HERE / "data"
def test_get_expected_output(caplog: LogCaptureFixture) -> None:
caplog.set_level(logging.INFO)
exit_code, _ = get_expected_output(DATA_DIRECTORY / "t.toml", USER_SPECIFIC_PATH)
assert "Too much .out files" in str(caplog.text)
assert exit_code == -1
exit_code, _ = get_expected_output(DATA_DIRECTORY / "u.toml", USER_SPECIFIC_PATH)
assert exit_code == -1
assert "Wrong format for .out file name" in str(caplog.text)
exit_code, _ = get_expected_output(DATA_DIRECTORY / "v.toml", USER_SPECIFIC_PATH)
assert exit_code == 0
assert ".out file does not exists" in str(caplog.text)