diff options
author | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2022-04-07 14:12:51 +0200 |
---|---|---|
committer | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2022-04-15 15:01:57 +0200 |
commit | 18bf64cb06b1f58c69c074c157b038c106ec0a31 (patch) | |
tree | c866811ba8e4c7d1c59f2690ffb072f3657d7732 /tests/test_similar.py | |
parent | 9cfe8366d43713f99ce2242ad4b7cd3e4b97c340 (diff) | |
download | pylint-git-18bf64cb06b1f58c69c074c157b038c106ec0a31.tar.gz |
Move '_patch_stream' to pylint.testutil
Diffstat (limited to 'tests/test_similar.py')
-rw-r--r-- | tests/test_similar.py | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/tests/test_similar.py b/tests/test_similar.py index 2c258a019..868284e5b 100644 --- a/tests/test_similar.py +++ b/tests/test_similar.py @@ -4,12 +4,9 @@ from __future__ import annotations -import contextlib import os import re -import sys import warnings -from collections.abc import Iterator from io import StringIO from os.path import abspath, dirname, join from typing import TextIO @@ -17,22 +14,13 @@ from typing import TextIO import pytest from pylint.lint import Run +from pylint.testutils.utils import _patch_streams HERE = abspath(dirname(__file__)) DATA = join(HERE, "regrtest_data", "duplicate_code") CLEAN_PATH = re.escape(dirname(dirname(__file__)) + os.path.sep) -@contextlib.contextmanager -def _patch_streams(out: TextIO) -> Iterator: - sys.stderr = sys.stdout = out - try: - yield - finally: - sys.stderr = sys.__stderr__ - sys.stdout = sys.__stdout__ - - class TestSimilarCodeChecker: def _runtest(self, args: list[str], code: int) -> None: """Runs the tests and sees if output code is as expected.""" |