From ffd43e9dc3b90bd698088fc7ebac9dbc6a4444b2 Mon Sep 17 00:00:00 2001 From: trl75 Date: Wed, 22 May 2024 16:56:03 -0400 Subject: [PATCH] Fixed missing reset on _compat.should_strip_ansi. --- CHANGES.rst | 2 ++ src/click/testing.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 7429d33ea..79b9e9deb 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -27,6 +27,8 @@ Unreleased :issue:`2452` - Refactor code generating default ``--help`` option to deduplicate code. :pr:`2563` +- Test ``CLIRunner`` resets patched ``_compat.should_strip_ansi``. + :issue:`2732` Version 8.1.7 diff --git a/src/click/testing.py b/src/click/testing.py index b517fd09f..772b2159c 100644 --- a/src/click/testing.py +++ b/src/click/testing.py @@ -312,6 +312,7 @@ def should_strip_ansi( old_hidden_prompt_func = termui.hidden_prompt_func old__getchar_func = termui._getchar old_should_strip_ansi = utils.should_strip_ansi # type: ignore + old__compat_should_strip_ansi = _compat.should_strip_ansi termui.visible_prompt_func = visible_input termui.hidden_prompt_func = hidden_input termui._getchar = _getchar @@ -346,6 +347,7 @@ def should_strip_ansi( termui.hidden_prompt_func = old_hidden_prompt_func termui._getchar = old__getchar_func utils.should_strip_ansi = old_should_strip_ansi # type: ignore + _compat.should_strip_ansi = old__compat_should_strip_ansi formatting.FORCED_WIDTH = old_forced_width def invoke(