diff --git a/0001-Remove-deprecated-sphinx-testing-dependency.patch b/0001-Remove-deprecated-sphinx-testing-dependency.patch new file mode 100644 index 0000000..8ae3ae9 --- /dev/null +++ b/0001-Remove-deprecated-sphinx-testing-dependency.patch @@ -0,0 +1,165 @@ +From 06cd5abff4a05929178fb79fd7c9f09705640b13 Mon Sep 17 00:00:00 2001 +From: Daniel Garcia Moreno +Date: Mon, 3 Oct 2022 12:08:38 +0200 +Subject: [PATCH] Remove deprecated sphinx-testing dependency + +This patch replaces the sphinx-testing package using the SphinxTestApp +provided by the Sphinx package. + +The sphinx-testing package is deprecated and should be replaced with +the sphinx.testing package that's bundled with Sphinx. + +Change-Id: I60b4d1a8b83dc35c394e29d746a2fbb3ff744c1a +--- + os_api_ref/tests/base.py | 27 ++++++++++++++++++++++++++ + os_api_ref/tests/test_basic_example.py | 16 +-------------- + os_api_ref/tests/test_microversions.py | 5 ++--- + os_api_ref/tests/test_warnings.py | 4 +--- + test-requirements.txt | 1 - + 5 files changed, 31 insertions(+), 22 deletions(-) + +diff --git a/os_api_ref/tests/base.py b/os_api_ref/tests/base.py +index 730258f..6e5e0dc 100644 +--- a/os_api_ref/tests/base.py ++++ b/os_api_ref/tests/base.py +@@ -16,8 +16,12 @@ + import os + + import fixtures ++import tempfile + import testtools + ++from sphinx.testing.path import path ++from sphinx.testing.util import SphinxTestApp ++ + + def example_dir(name=""): + return os.path.join(os.path.dirname(__file__), 'examples', name) +@@ -26,6 +30,29 @@ def example_dir(name=""): + _TRUE_VALUES = ('True', 'true', '1', 'yes') + + ++class with_app: ++ def __init__(self, **kwargs): ++ if 'srcdir' in kwargs: ++ self.srcdir = path(kwargs['srcdir']) ++ self.sphinx_app_args = kwargs ++ ++ def __call__(self, f): ++ def newf(*args, **kwargs): ++ with tempfile.TemporaryDirectory() as tmpdirname: ++ tmpdir = path(tmpdirname) ++ tmproot = tmpdir / self.srcdir.basename() ++ self.srcdir.copytree(tmproot) ++ self.sphinx_app_args['srcdir'] = tmproot ++ self.builddir = tmproot.joinpath('_build') ++ ++ app = SphinxTestApp(freshenv=True, **self.sphinx_app_args) ++ ++ f(*args, app, app._status, app._warning, **kwargs) ++ ++ app.cleanup() ++ return newf ++ ++ + class OutputStreamCapture(fixtures.Fixture): + """Capture output streams during tests. + +diff --git a/os_api_ref/tests/test_basic_example.py b/os_api_ref/tests/test_basic_example.py +index 4a82a6a..83e2892 100644 +--- a/os_api_ref/tests/test_basic_example.py ++++ b/os_api_ref/tests/test_basic_example.py +@@ -18,23 +18,10 @@ Tests for `os_api_ref` module. + """ + + from bs4 import BeautifulSoup +-import sphinx +-from sphinx_testing import with_app + + from os_api_ref.tests import base + + +-# FIXME(stephenfin): This is horrible. We're monkeypatching this to work around +-# the fact that Sphinx 1.8+ started called 'abspath' from within the +-# 'sphinx.application.Application' class [1]. This means our careful use of +-# 'sphinx_testing.path.path' for 'Application.outdir' etc. gets stomped on. +-# We're correcting that but we're doing so globally because mock doesn't work +-# for some reason and this is bound to have some side effects +-# +-# [1] https://github.com/sphinx-doc/sphinx/commit/3a85b3502f +-sphinx.application.abspath = lambda x: x +- +- + class TestBasicExample(base.TestCase): + """Test basic rendering. + +@@ -42,8 +29,7 @@ class TestBasicExample(base.TestCase): + examples, so if someone breaks something we know. + """ + +- @with_app(buildername='html', srcdir=base.example_dir('basic'), +- copy_srcdir_to_tmpdir=True) ++ @base.with_app(buildername='html', srcdir=base.example_dir('basic')) + def setUp(self, app, status, warning): + super(TestBasicExample, self).setUp() + self.app = app +diff --git a/os_api_ref/tests/test_microversions.py b/os_api_ref/tests/test_microversions.py +index 7da8c2f..8281442 100644 +--- a/os_api_ref/tests/test_microversions.py ++++ b/os_api_ref/tests/test_microversions.py +@@ -18,7 +18,6 @@ Tests for `os_api_ref` module. + """ + + from bs4 import BeautifulSoup +-from sphinx_testing import with_app + + from os_api_ref.tests import base + +@@ -30,8 +29,8 @@ class TestMicroversions(base.TestCase): + examples, so if someone breaks something we know. + """ + +- @with_app(buildername='html', srcdir=base.example_dir('microversions'), +- copy_srcdir_to_tmpdir=True) ++ @base.with_app(buildername='html', ++ srcdir=base.example_dir('microversions')) + def setUp(self, app, status, warning): + super(TestMicroversions, self).setUp() + self.app = app +diff --git a/os_api_ref/tests/test_warnings.py b/os_api_ref/tests/test_warnings.py +index 0a588d2..9fa9fef 100644 +--- a/os_api_ref/tests/test_warnings.py ++++ b/os_api_ref/tests/test_warnings.py +@@ -18,7 +18,6 @@ Tests for `os_api_ref` module. + """ + + from bs4 import BeautifulSoup +-from sphinx_testing import with_app + + from os_api_ref.tests import base + +@@ -30,8 +29,7 @@ class TestWarnings(base.TestCase): + examples, so if someone breaks something we know. + """ + +- @with_app(buildername='html', srcdir=base.example_dir('warnings'), +- copy_srcdir_to_tmpdir=True) ++ @base.with_app(buildername='html', srcdir=base.example_dir('warnings')) + def setUp(self, app, status, warning): + super(TestWarnings, self).setUp() + self.app = app +diff --git a/test-requirements.txt b/test-requirements.txt +index d165510..0fd36ef 100644 +--- a/test-requirements.txt ++++ b/test-requirements.txt +@@ -8,7 +8,6 @@ coverage!=4.4,>=4.0 # Apache-2.0 + python-subunit>=1.0.0 # Apache-2.0/BSD + testrepository>=0.0.18 # Apache-2.0/BSD + testtools>=2.2.0 # MIT +-sphinx-testing>=1.0.1 # BSD License + beautifulsoup4>=4.6.0 # MIT + stestr>=2.0.0 # Apache-2.0 + pre-commit>=2.6.0 # MIT +-- +2.37.3 + diff --git a/python-os-api-ref.changes b/python-os-api-ref.changes index 5ea1617..85741bf 100644 --- a/python-os-api-ref.changes +++ b/python-os-api-ref.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue Oct 4 15:02:18 UTC 2022 - cloud-devel@suse.de + +- added 0001-Remove-deprecated-sphinx-testing-dependency.patch + ------------------------------------------------------------------- Fri May 13 18:43:59 UTC 2022 - cloud-devel@suse.de diff --git a/python-os-api-ref.spec b/python-os-api-ref.spec index 37545cb..4781dcb 100644 --- a/python-os-api-ref.spec +++ b/python-os-api-ref.spec @@ -24,6 +24,8 @@ License: Apache-2.0 Group: Development/Languages/Python URL: https://docs.openstack.org/os-api-ref Source0: https://files.pythonhosted.org/packages/source/o/os-api-ref/os-api-ref-2.3.0.tar.gz +# https://review.opendev.org/c/openstack/os-api-ref/+/860080 +Patch0: 0001-Remove-deprecated-sphinx-testing-dependency.patch BuildRequires: openstack-macros BuildRequires: python3-PyYAML >= 3.12 BuildRequires: python3-Sphinx @@ -31,8 +33,6 @@ BuildRequires: python3-beautifulsoup4 BuildRequires: python3-openstackdocstheme >= 2.2.1 BuildRequires: python3-pbr >= 2.0.0 BuildRequires: python3-python-subunit -BuildRequires: python3-six -BuildRequires: python3-sphinx-testing BuildRequires: python3-stestr BuildRequires: python3-testtools BuildArch: noarch @@ -55,7 +55,6 @@ Requires: python3-PyYAML >= 3.12 Requires: python3-Sphinx Requires: python3-openstackdocstheme >= 2.2.1 Requires: python3-pbr >= 2.0.0 -Requires: python3-six %description -n python3-os-api-ref This project is a collection of sphinx stanzas that assist in building an API