From f540cdafa988b53f2ba0c50c4e036b304d46582a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Wed, 12 Apr 2023 16:37:58 +0200 Subject: [PATCH] Fix test failures with pytest 7.3.0 --- pytest-7.3.patch | 24 ++++++++++++++++++++++++ python-click.spec | 10 +++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 pytest-7.3.patch diff --git a/pytest-7.3.patch b/pytest-7.3.patch new file mode 100644 index 0000000..02a277b --- /dev/null +++ b/pytest-7.3.patch @@ -0,0 +1,24 @@ +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, diff --git a/python-click.spec b/python-click.spec index 1e472ab..01ec227 100644 --- a/python-click.spec +++ b/python-click.spec @@ -2,12 +2,17 @@ Name: python-%{pypi_name} Version: 8.1.3 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Simple wrapper around optparse for powerful command line utilities License: BSD URL: https://github.com/mitsuhiko/click Source0: %{url}/archive/%{version}/%{pypi_name}-%{version}.tar.gz + +# Fix test failures with pytest 7.3.0 +# From https://github.com/pallets/click/issues/2489#issuecomment-1504160617 by Ran Benita +Patch: pytest-7.3.patch + BuildArch: noarch %global _description \ @@ -49,6 +54,9 @@ sed -i 's|requirements/tests.txt|requirements/tests.in|' tox.ini %doc README.rst CHANGES.rst %changelog +* Wed Apr 12 2023 Miro HronĨok - 8.1.3-3 +- Fix test failures with pytest 7.3.0 + * Fri Jan 20 2023 Fedora Release Engineering - 8.1.3-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild