summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSagi Buchbinder Shadur <saroad2@gmail.com>2023-05-03 12:27:35 -0400
committerSagi Buchbinder Shadur <saroad2@gmail.com>2023-05-03 12:27:35 -0400
commitb0538dffe889ff5d03934927c31a9b71e5129848 (patch)
tree8d372bb09db05999ab0c3fc1ef5ac4d2219d871c /tests
parentcd7b51cf98b8ac1d773ac726326a041bf4eafc14 (diff)
parent6e05e1fa1c2804410f9916b27edc07076e3b156d (diff)
downloadclick-b0538dffe889ff5d03934927c31a9b71e5129848.tar.gz
Merge branch '8.1.x'HEADmain
Diffstat (limited to 'tests')
-rw-r--r--tests/test_arguments.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/test_arguments.py b/tests/test_arguments.py
index 735df4b..3395c55 100644
--- a/tests/test_arguments.py
+++ b/tests/test_arguments.py
@@ -1,4 +1,5 @@
import sys
+from unittest import mock
import pytest
@@ -86,9 +87,12 @@ def test_bytes_args(runner, monkeypatch):
), "UTF-8 encoded argument should be implicitly converted to Unicode"
# Simulate empty locale environment variables
- monkeypatch.setattr(sys.stdin, "encoding", "utf-8")
monkeypatch.setattr(sys, "getfilesystemencoding", lambda: "utf-8")
monkeypatch.setattr(sys, "getdefaultencoding", lambda: "utf-8")
+ # sys.stdin.encoding is readonly, needs some extra effort to patch.
+ stdin = mock.Mock(wraps=sys.stdin)
+ stdin.encoding = "utf-8"
+ monkeypatch.setattr(sys, "stdin", stdin)
runner.invoke(
from_bytes,