diff --git a/os_api_ref/tests/base.py b/os_api_ref/tests/base.py index 6e5e0dc..cd2bcdb 100644 --- a/os_api_ref/tests/base.py +++ b/os_api_ref/tests/base.py @@ -14,12 +14,13 @@ # under the License. import os +import pathlib +import shutil import fixtures import tempfile import testtools -from sphinx.testing.path import path from sphinx.testing.util import SphinxTestApp @@ -32,16 +33,15 @@ _TRUE_VALUES = ('True', 'true', '1', 'yes') class with_app: def __init__(self, **kwargs): - if 'srcdir' in kwargs: - self.srcdir = path(kwargs['srcdir']) + self.srcdir = pathlib.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) + tmpdir = pathlib.Path(tmpdirname) + tmproot = tmpdir.joinpath(self.srcdir.name) + shutil.copytree(self.srcdir, tmproot) self.sphinx_app_args['srcdir'] = tmproot self.builddir = tmproot.joinpath('_build') diff --git a/os_api_ref/tests/test_basic_example.py b/os_api_ref/tests/test_basic_example.py index 83e2892..ba78658 100644 --- a/os_api_ref/tests/test_basic_example.py +++ b/os_api_ref/tests/test_basic_example.py @@ -74,12 +74,6 @@ class TestBasicExample(base.TestCase): def test_parameters(self): """Do we get some parameters table""" table = """
Name |
In |
@@ -99,10 +93,6 @@ class TestBasicExample(base.TestCase):
def test_rest_response(self):
success_table = """
|---|
Code |
Reason |
@@ -122,10 +112,6 @@ class TestBasicExample(base.TestCase):
|---|
Code |
Reason |
diff --git a/os_api_ref/tests/test_microversions.py b/os_api_ref/tests/test_microversions.py
index 8281442..d6794a4 100644
--- a/os_api_ref/tests/test_microversions.py
+++ b/os_api_ref/tests/test_microversions.py
@@ -44,11 +44,11 @@ class TestMicroversions(base.TestCase):
def test_rest_method(self):
"""Test that min / max mv css class attributes are set"""
content = self.soup.find_all(class_='rp_min_ver_2_17')
- self.assertRegexpMatches(
+ self.assertRegex(
str(content[0]),
'^||
|---|---|---|---|
Name |
In |
diff --git a/os_api_ref/tests/test_warnings.py b/os_api_ref/tests/test_warnings.py
index 9fa9fef..a112986 100644
--- a/os_api_ref/tests/test_warnings.py
+++ b/os_api_ref/tests/test_warnings.py
@@ -17,6 +17,8 @@ test_os_api_ref
Tests for `os_api_ref` module.
"""
+from collections import OrderedDict
+
from bs4 import BeautifulSoup
from os_api_ref.tests import base
@@ -55,11 +57,16 @@ class TestWarnings(base.TestCase):
def test_missing_field(self):
"""Warning when missing type field in parameter file."""
+ # py312 changes string interpretation of OrderedDict.
+ # Prevent such failures by using OrderedDict directly
+ cmp_data = OrderedDict({
+ "description": "name_1 is missing type field.\n",
+ "in": "body",
+ "required": True
+ })
self.assertIn(
("WARNING: Failure on key: name, values: " +
- "OrderedDict([('description'," +
- " 'name_1 is missing type field.\\n'), ('in', 'body')," +
- " ('required', True)]). " +
+ f"{cmp_data}. " +
"'NoneType' object has no attribute 'split'"),
self.warning)
diff --git a/setup.cfg b/setup.cfg
index ceb213d..3deaefe 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -6,7 +6,7 @@ description_file =
author = OpenStack
author_email = openstack-discuss@lists.openstack.org
home_page = https://docs.openstack.org/os-api-ref/latest/
-python_requires = >=3.8
+python_requires = >=3.9
classifier =
Environment :: OpenStack
Intended Audience :: Information Technology
@@ -15,8 +15,10 @@ classifier =
Operating System :: POSIX :: Linux
Programming Language :: Python
Programming Language :: Python :: 3
- Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
+ Programming Language :: Python :: 3.10
+ Programming Language :: Python :: 3.11
+ Programming Language :: Python :: 3.12
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: Implementation :: CPython
diff --git a/test-requirements.txt b/test-requirements.txt
index 0fd36ef..bf005dc 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -11,3 +11,6 @@ testtools>=2.2.0 # MIT
beautifulsoup4>=4.6.0 # MIT
stestr>=2.0.0 # Apache-2.0
pre-commit>=2.6.0 # MIT
+
+# The minimum version requirement is specific to unit tests.
+sphinx>=7.2.0 # BSD