diff options
| author | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2025-03-14 13:27:30 +0100 |
|---|---|---|
| committer | Baptiste Mispelon <bmispelon@gmail.com> | 2025-03-14 20:29:33 +0100 |
| commit | 1e428d9618521e68a33c3f4c1e03ef271e411634 (patch) | |
| tree | d34c2a1f62b5099588904cfe50d40902bea9ad7b /docs | |
| parent | 1ee5166d50806b9da29f64c440c87beec5b6516d (diff) | |
Added Sphinx clean up global state call.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/management/commands/update_docs.py | 3 | ||||
| -rw-r--r-- | docs/tests/test_builder.py | 6 |
2 files changed, 9 insertions, 0 deletions
diff --git a/docs/management/commands/update_docs.py b/docs/management/commands/update_docs.py index 859e5fa0..aed01f12 100644 --- a/docs/management/commands/update_docs.py +++ b/docs/management/commands/update_docs.py @@ -21,6 +21,7 @@ from django.utils.translation import to_locale from sphinx.application import Sphinx from sphinx.config import Config from sphinx.errors import SphinxError +from sphinx.testing.util import _clean_up_global_state from sphinx.util.docutils import docutils_namespace, patch_docutils from ...models import DocumentRelease @@ -233,6 +234,8 @@ class Command(BaseCommand): "extensions": extensions, }, ).build() + # Clean up global state after building each language. + _clean_up_global_state() except SphinxError as e: self.stderr.write( "sphinx-build returned an error (release %s, builder %s): %s" diff --git a/docs/tests/test_builder.py b/docs/tests/test_builder.py index 906951b6..66332603 100644 --- a/docs/tests/test_builder.py +++ b/docs/tests/test_builder.py @@ -1,6 +1,7 @@ from unittest.mock import Mock, patch from django.test import SimpleTestCase +from sphinx.testing.util import _clean_up_global_state from ..builder import DomainObject, PythonObjectsJSONHTMLBuilder @@ -61,3 +62,8 @@ class TestPythonObjectsJSONHTMLBuilder(SimpleTestCase): self.assertIn("python_objects_search", result) self.assertEqual(result["python_objects"], {"ClassA": "module1.ClassA"}) self.assertEqual(result["python_objects_search"], "ClassA") + + +class TestSphinxAPI(SimpleTestCase): + def test_private_sphinx_function_exists(self): + _clean_up_global_state() |
