diff options
author | David Lord <davidism@gmail.com> | 2021-04-04 08:03:22 -0700 |
---|---|---|
committer | David Lord <davidism@gmail.com> | 2021-04-04 08:08:18 -0700 |
commit | ad2482bf696df25025ee78fb81a8cf91256af6a5 (patch) | |
tree | 68c392a21ca4403d47e29427e1dbc9a4972e41b3 /src/click/testing.py | |
parent | c4542263a96dd067ed1ded12a83553da05bb61dd (diff) | |
download | click-ad2482bf696df25025ee78fb81a8cf91256af6a5.tar.gz |
test runner opens stderr with backslashreplace
Diffstat (limited to 'src/click/testing.py')
-rw-r--r-- | src/click/testing.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/click/testing.py b/src/click/testing.py index 557fbef..3bbdbff 100644 --- a/src/click/testing.py +++ b/src/click/testing.py @@ -178,13 +178,17 @@ class CliRunner: This is automatically done in the :meth:`invoke` method. - .. versionadded:: 4.0 - The ``color`` parameter was added. - :param input: the input stream to put into sys.stdin. :param env: the environment overrides as dictionary. :param color: whether the output should contain color codes. The application can still override this explicitly. + + .. versionchanged:: 8.0 + ``stderr`` is opened with ``errors="backslashreplace"`` + instead of the default ``"strict"``. + + .. versionchanged:: 4.0 + Added the ``color`` parameter. """ input = make_input_stream(input, self.charset) @@ -214,7 +218,11 @@ class CliRunner: else: bytes_error = io.BytesIO() sys.stderr = _NamedTextIOWrapper( - bytes_error, encoding=self.charset, name="<stderr>", mode="w" + bytes_error, + encoding=self.charset, + name="<stderr>", + mode="w", + errors="backslashreplace", ) def visible_input(prompt=None): |