From cb6fc62f0b9f23e44ca1d0aa4de7aed9f86df84d8fb50d92b7d8d97845f391f3 Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Fri, 29 Jul 2022 07:43:15 +0000 Subject: [PATCH] - Add patch pytest-7-support.patch: * Support pytest >= 7. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-humanfriendly?expand=0&rev=36 --- pytest-7-support.patch | 37 ++++++++++++++++++++++++++++++++++++ python-humanfriendly.changes | 6 ++++++ python-humanfriendly.spec | 5 +++-- 3 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 pytest-7-support.patch diff --git a/pytest-7-support.patch b/pytest-7-support.patch new file mode 100644 index 0000000..ad6f675 --- /dev/null +++ b/pytest-7-support.patch @@ -0,0 +1,37 @@ +From 1789ed31946ba6353c8b26332344608519722a88 Mon Sep 17 00:00:00 2001 +From: Steve Kowalik +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'] diff --git a/python-humanfriendly.changes b/python-humanfriendly.changes index 7fcf14c..1b798e5 100644 --- a/python-humanfriendly.changes +++ b/python-humanfriendly.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Jul 29 07:42:02 UTC 2022 - Steve Kowalik + +- Add patch pytest-7-support.patch: + * Support pytest >= 7. + ------------------------------------------------------------------- Mon Mar 21 12:15:56 UTC 2022 - pgajdos@suse.com diff --git a/python-humanfriendly.spec b/python-humanfriendly.spec index d6dc54e..a25f8b2 100644 --- a/python-humanfriendly.spec +++ b/python-humanfriendly.spec @@ -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