diff --git a/python-sphinxcontrib-htmlhelp.changes b/python-sphinxcontrib-htmlhelp.changes
index e11a452..b850e9c 100644
--- a/python-sphinxcontrib-htmlhelp.changes
+++ b/python-sphinxcontrib-htmlhelp.changes
@@ -1,3 +1,8 @@
+-------------------------------------------------------------------
+Mon May 30 10:38:17 UTC 2022 - Markéta Machová
+
+- Add upstream patch sphinx5.patch to fix build with the new Sphinx
+
-------------------------------------------------------------------
Sun Jun 6 12:12:35 UTC 2021 - Dirk Müller
diff --git a/python-sphinxcontrib-htmlhelp.spec b/python-sphinxcontrib-htmlhelp.spec
index 44c1695..98ebdcf 100644
--- a/python-sphinxcontrib-htmlhelp.spec
+++ b/python-sphinxcontrib-htmlhelp.spec
@@ -1,7 +1,7 @@
#
# spec file
#
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -34,6 +34,8 @@ License: BSD-2-Clause
Group: Development/Languages/Python
URL: https://github.com/sphinx-doc/sphinxcontrib-htmlhelp
Source: https://files.pythonhosted.org/packages/source/s/sphinxcontrib-htmlhelp/sphinxcontrib-htmlhelp-%{version}.tar.gz
+# PATCH-FIX-UPSTREAM https://github.com/sphinx-doc/sphinxcontrib-htmlhelp/commit/248ff52b3c3d39c20cdaef3052ac7507a407733a Fix #9457: RemovedInSphinx50Warning on testing
+Patch0: sphinx5.patch
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
@@ -52,6 +54,7 @@ Html help generating extension.
%prep
%setup -q -n sphinxcontrib-htmlhelp-%{version}
+%autopatch -p1
%build
%python_build
diff --git a/sphinx5.patch b/sphinx5.patch
new file mode 100644
index 0000000..51c8273
--- /dev/null
+++ b/sphinx5.patch
@@ -0,0 +1,22 @@
+Index: sphinxcontrib-htmlhelp-2.0.0/tests/test_htmlhelp.py
+===================================================================
+--- sphinxcontrib-htmlhelp-2.0.0.orig/tests/test_htmlhelp.py
++++ sphinxcontrib-htmlhelp-2.0.0/tests/test_htmlhelp.py
+@@ -21,7 +21,7 @@ from sphinx.config import Config
+ def test_build_htmlhelp(app, status, warning):
+ app.build()
+
+- hhp = (app.outdir / 'pythondoc.hhp').text()
++ hhp = (app.outdir / 'pythondoc.hhp').read_text()
+ assert 'Compiled file=pythondoc.chm' in hhp
+ assert 'Contents file=pythondoc.hhc' in hhp
+ assert 'Default Window=pythondoc' in hhp
+@@ -84,7 +84,7 @@ def test_htmlhelp_hhc(app):
+ assert node[1].attrib == {'name': 'Local', 'value': filename}
+
+ # .hhc file
+- hhc = (app.outdir / 'pythondoc.hhc').text()
++ hhc = (app.outdir / 'pythondoc.hhc').read_text()
+ tree = HTMLParser(namespaceHTMLElements=False).parse(hhc)
+ items = tree.find('.//body/ul')
+ assert len(items) == 4