15
0

Accepting request 991672 from devel:languages:python

- Add patch pytest-7-support.patch:
  * Support pytest >= 7.

OBS-URL: https://build.opensuse.org/request/show/991672
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-humanfriendly?expand=0&rev=18
This commit is contained in:
2022-07-29 14:48:17 +00:00
committed by Git OBS Bridge
3 changed files with 46 additions and 2 deletions

37
pytest-7-support.patch Normal file
View File

@@ -0,0 +1,37 @@
From 1789ed31946ba6353c8b26332344608519722a88 Mon Sep 17 00:00:00 2001
From: Steve Kowalik <steven@wedontsleep.org>
Date: Fri, 29 Jul 2022 17:19:38 +1000
Subject: [PATCH] Do not import setup in the tests module
pytest 7 and above will call any setup as a hook for any module
collected, which in this case calls into the Sphinx machinery due to
importing the setup function from there. Import it as something else so
that pytest will not call it.
Fixes #64
---
humanfriendly/tests.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/humanfriendly/tests.py b/humanfriendly/tests.py
index 72dad99..d019a2f 100644
--- a/humanfriendly/tests.py
+++ b/humanfriendly/tests.py
@@ -59,7 +59,7 @@
deprecation_note_callback,
man_role,
pypi_role,
- setup,
+ setup as sphinx_setup,
special_methods_callback,
usage_message_callback,
)
@@ -1444,7 +1444,7 @@ def bogus_usage(self):
# Test event callback registration.
fake_app = FakeApp()
- setup(fake_app)
+ sphinx_setup(fake_app)
assert man_role == fake_app.roles['man']
assert pypi_role == fake_app.roles['pypi']
assert deprecation_note_callback in fake_app.callbacks['autodoc-process-docstring']

View File

@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Jul 29 07:42:02 UTC 2022 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch pytest-7-support.patch:
* Support pytest >= 7.
-------------------------------------------------------------------
Mon Mar 21 12:15:56 UTC 2022 - pgajdos@suse.com

View File

@@ -35,6 +35,8 @@ URL: https://github.com/xolox/python-humanfriendly
Source: https://files.pythonhosted.org/packages/source/h/humanfriendly/humanfriendly-%{version}.tar.gz
# https://github.com/xolox/python-humanfriendly/issues/62
Patch0: python-humanfriendly-no-mock.patch
# PATCH-FIX-UPSTREAM gh#xolox/python-humanfriendly#65
Patch1: pytest-7-support.patch
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
@@ -74,8 +76,7 @@ text interfaces more user friendly.
friendly rendering of usage messages and querying the terminal for its size.
%prep
%setup -q -n humanfriendly-%{version}
%patch0 -p1
%autosetup -p1 -n humanfriendly-%{version}
%build
%python_build