diff options
Diffstat (limited to 'tests/unittest_reporting.py')
-rw-r--r-- | tests/unittest_reporting.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/tests/unittest_reporting.py b/tests/unittest_reporting.py index c0fdb61d4..7400be9e5 100644 --- a/tests/unittest_reporting.py +++ b/tests/unittest_reporting.py @@ -16,7 +16,7 @@ # 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 # pylint: disable=redefined-outer-name - +import sys import warnings from contextlib import redirect_stdout from io import StringIO @@ -48,7 +48,7 @@ def disable(): def test_template_option(linter): output = StringIO() - linter.reporter.set_output(output) + linter.reporter.out = output linter.set_option("msg-template", "{msg_id}:{line:03d}") linter.open() linter.set_current_module("0123") @@ -57,6 +57,16 @@ def test_template_option(linter): assert output.getvalue() == "************* Module 0123\nC0301:001\nC0301:002\n" +def test_deprecation_set_output(recwarn): + """TODO remove in 3.0""" # pylint: disable=fixme + reporter = BaseReporter() + # noinspection PyDeprecation + reporter.set_output(sys.stdout) + warning = recwarn.pop() + assert "set_output' will be removed in 3.0" in str(warning) + assert reporter.out == sys.stdout + + def test_parseable_output_deprecated(): with warnings.catch_warnings(record=True) as cm: warnings.simplefilter("always") @@ -73,7 +83,7 @@ def test_parseable_output_regression(): checkers.initialize(linter) linter.config.persistent = 0 - linter.reporter.set_output(output) + linter.reporter.out = output linter.set_option("output-format", "parseable") linter.open() linter.set_current_module("0123") @@ -122,7 +132,7 @@ def test_multi_format_output(tmp_path): assert linter.reporter.linter is linter with pytest.raises(NotImplementedError): - linter.reporter.set_output(text) + linter.reporter.out = text linter.open() linter.check_single_file_item(FileItem("somemodule", source_file, "somemodule")) |