diff options
author | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2023-03-29 10:59:39 +0200 |
---|---|---|
committer | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2023-03-29 11:38:51 +0200 |
commit | 155298f87f230e249875b14481440822c82609e5 (patch) | |
tree | 78398ff5718f9674633f63a9ea6ecb985bdf6509 /tests/lint | |
parent | 5e94497239058514d4e186edb4eed9b670af9ddc (diff) | |
download | pylint-git-155298f87f230e249875b14481440822c82609e5.tar.gz |
[crash template] Link to blank issue so it's possible to copy paste
Diffstat (limited to 'tests/lint')
-rw-r--r-- | tests/lint/test_utils.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/lint/test_utils.py b/tests/lint/test_utils.py index 872919f72..682a65fdd 100644 --- a/tests/lint/test_utils.py +++ b/tests/lint/test_utils.py @@ -7,6 +7,7 @@ from pathlib import Path, PosixPath import pytest +from pylint.constants import full_version from pylint.lint.utils import get_fatal_error_message, prepare_crash_report from pylint.testutils._run import _Run as Run @@ -17,19 +18,22 @@ def test_prepare_crash_report(tmp_path: PosixPath) -> None: python_content = "from shadok import MagicFaucet" with open(python_file, "w", encoding="utf8") as f: f.write(python_content) + template_path = None try: - raise Exception(exception_content) # pylint: disable=broad-exception-raised - except Exception as ex: # pylint: disable=broad-except + raise ValueError(exception_content) + except ValueError as ex: template_path = prepare_crash_report( ex, str(python_file), str(tmp_path / "pylint-crash-%Y.txt") ) - assert str(tmp_path) in str(template_path) # pylint: disable=used-before-assignment + assert str(tmp_path) in str(template_path) with open(template_path, encoding="utf8") as f: template_content = f.read() assert python_content in template_content assert exception_content in template_content assert "in test_prepare_crash_report" in template_content - assert "raise Exception(exception_content)" in template_content + assert "raise ValueError(exception_content)" in template_content + assert "<details open>" in template_content + assert full_version in template_content def test_get_fatal_error_message() -> None: |