diff options
author | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2022-07-10 17:35:57 +0200 |
---|---|---|
committer | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2022-07-11 06:49:50 +0200 |
commit | 46abb7246baac1effc68cb73852fb2cead959726 (patch) | |
tree | a38d9611d08e342a2ac02fe19e338b2273086712 /tests/test_self.py | |
parent | 23a70e6f2721edbf1b74a4fb212837333f6cea20 (diff) | |
download | pylint-git-46abb7246baac1effc68cb73852fb2cead959726.tar.gz |
[refactor] Move test context manager to pylint.testutils
Diffstat (limited to 'tests/test_self.py')
-rw-r--r-- | tests/test_self.py | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/tests/test_self.py b/tests/test_self.py index d745161c5..ddf0bbacd 100644 --- a/tests/test_self.py +++ b/tests/test_self.py @@ -37,7 +37,7 @@ from pylint.reporters import JSONReporter from pylint.reporters.text import BaseReporter, ColorizedTextReporter, TextReporter from pylint.testutils._run import _add_rcfile_default_pylintrc from pylint.testutils._run import _Run as Run -from pylint.testutils.utils import _patch_streams +from pylint.testutils.utils import _patch_streams, _test_cwd, _test_sys_path from pylint.utils import utils if sys.version_info >= (3, 11): @@ -69,24 +69,6 @@ def _configure_lc_ctype(lc_ctype: str) -> Iterator: os.environ[lc_ctype_env] = original_lctype -@contextlib.contextmanager -def _test_sys_path() -> Generator[None, None, None]: - original_path = sys.path - try: - yield - finally: - sys.path = original_path - - -@contextlib.contextmanager -def _test_cwd() -> Generator[None, None, None]: - original_dir = os.getcwd() - try: - yield - finally: - os.chdir(original_dir) - - class MultiReporter(BaseReporter): def __init__(self, reporters: list[BaseReporter]) -> None: # pylint: disable=super-init-not-called |