Initial commit
This commit is contained in:
+41
@@ -0,0 +1,41 @@
|
||||
From da83bd7ca0959027086115f23534957b0917aaa5 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Thu, 27 Apr 2023 22:21:24 -0700
|
||||
Subject: [PATCH] tests: Fix test_bytes_args
|
||||
|
||||
sys.stdin.encoding is readonly therefore use Mocking to wrap it.
|
||||
Sourced from - Alpine
|
||||
|
||||
Upstream-Status: Pending
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
tests/test_arguments.py | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
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,
|
||||
--
|
||||
2.40.1
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
pytest -o log_cli=true -o log_cli_level=INFO | sed -e 's/\[...%\]//g'| sed -e 's/PASSED/PASS/g'| sed -e 's/FAILED/FAIL/g'|sed -e 's/SKIPPED/SKIP/g'| awk '{if ($NF=="PASS" || $NF=="FAIL" || $NF=="SKIP" || $NF=="XFAIL" || $NF=="XPASS"){printf "%s: %s\n", $NF, $0}else{print}}'| awk '{if ($NF=="PASS" || $NF=="FAIL" || $NF=="SKIP" || $NF=="XFAIL" || $NF=="XPASS") {$NF="";print $0}else{print}}'
|
||||
Reference in New Issue
Block a user