summaryrefslogtreecommitdiffstats
path: root/meta-python
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2023-04-27 22:35:59 -0700
committerKhem Raj <raj.khem@gmail.com>2023-04-27 22:37:56 -0700
commit647468e3e1d15e527358e7d01091815f579037f9 (patch)
tree2006cc38a83fc64b0bd3cac0af44be3b38cf88dc /meta-python
parent4a9f3bfa227cf992df2ae9510f863f939a3c3689 (diff)
downloadmeta-openembedded-647468e3e1d15e527358e7d01091815f579037f9.tar.gz
python3-click: Fix ptest failure
test_bytes_args fails especially on musl, therefore use mocked sys.stdin.encoding Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-python')
-rw-r--r--meta-python/recipes-devtools/python/python3-click/0001-tests-Fix-test_bytes_args.patch41
-rw-r--r--meta-python/recipes-devtools/python/python3-click_8.1.3.bb1
2 files changed, 42 insertions, 0 deletions
diff --git a/meta-python/recipes-devtools/python/python3-click/0001-tests-Fix-test_bytes_args.patch b/meta-python/recipes-devtools/python/python3-click/0001-tests-Fix-test_bytes_args.patch
new file mode 100644
index 000000000..e69a37c40
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-click/0001-tests-Fix-test_bytes_args.patch
@@ -0,0 +1,41 @@
1From da83bd7ca0959027086115f23534957b0917aaa5 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 27 Apr 2023 22:21:24 -0700
4Subject: [PATCH] tests: Fix test_bytes_args
5
6sys.stdin.encoding is readonly therefore use Mocking to wrap it.
7Sourced from - Alpine
8
9Upstream-Status: Pending
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11---
12 tests/test_arguments.py | 6 +++++-
13 1 file changed, 5 insertions(+), 1 deletion(-)
14
15diff --git a/tests/test_arguments.py b/tests/test_arguments.py
16index 735df4b..3395c55 100644
17--- a/tests/test_arguments.py
18+++ b/tests/test_arguments.py
19@@ -1,4 +1,5 @@
20 import sys
21+from unittest import mock
22
23 import pytest
24
25@@ -86,9 +87,12 @@ def test_bytes_args(runner, monkeypatch):
26 ), "UTF-8 encoded argument should be implicitly converted to Unicode"
27
28 # Simulate empty locale environment variables
29- monkeypatch.setattr(sys.stdin, "encoding", "utf-8")
30 monkeypatch.setattr(sys, "getfilesystemencoding", lambda: "utf-8")
31 monkeypatch.setattr(sys, "getdefaultencoding", lambda: "utf-8")
32+ # sys.stdin.encoding is readonly, needs some extra effort to patch.
33+ stdin = mock.Mock(wraps=sys.stdin)
34+ stdin.encoding = "utf-8"
35+ monkeypatch.setattr(sys, "stdin", stdin)
36
37 runner.invoke(
38 from_bytes,
39--
402.40.1
41
diff --git a/meta-python/recipes-devtools/python/python3-click_8.1.3.bb b/meta-python/recipes-devtools/python/python3-click_8.1.3.bb
index 006742f15..9b8ea94c2 100644
--- a/meta-python/recipes-devtools/python/python3-click_8.1.3.bb
+++ b/meta-python/recipes-devtools/python/python3-click_8.1.3.bb
@@ -13,6 +13,7 @@ SRC_URI[sha256sum] = "7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37
13inherit pypi setuptools3 ptest 13inherit pypi setuptools3 ptest
14 14
15SRC_URI += " \ 15SRC_URI += " \
16 file://0001-tests-Fix-test_bytes_args.patch \
16 file://run-ptest \ 17 file://run-ptest \
17" 18"
18 19