summaryrefslogtreecommitdiffstats
path: root/tests/test_extension.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 11:31:33 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 11:31:33 +0000
commite863fd965dd6253243c3342bd6f0adc4fc8aec4d (patch)
treea4c1b6491a82593950043c3f8b2530e80664d768 /tests/test_extension.py
parentInitial commit. (diff)
downloadsphinx-e863fd965dd6253243c3342bd6f0adc4fc8aec4d.tar.xz
sphinx-e863fd965dd6253243c3342bd6f0adc4fc8aec4d.zip
Adding upstream version 5.3.0.upstream/5.3.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_extension.py')
-rw-r--r--tests/test_extension.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/test_extension.py b/tests/test_extension.py
new file mode 100644
index 0000000..d74743c
--- /dev/null
+++ b/tests/test_extension.py
@@ -0,0 +1,23 @@
+"""Test sphinx.extension module."""
+
+import pytest
+
+from sphinx.errors import VersionRequirementError
+from sphinx.extension import Extension, verify_needs_extensions
+
+
+def test_needs_extensions(app):
+ # empty needs_extensions
+ assert app.config.needs_extensions == {}
+ verify_needs_extensions(app, app.config)
+
+ # needs_extensions fulfilled
+ app.config.needs_extensions = {'test.extension': '3.9'}
+ app.extensions['test.extension'] = Extension('test.extension', 'test.extension', version='3.10')
+ verify_needs_extensions(app, app.config)
+
+ # needs_extensions not fulfilled
+ app.config.needs_extensions = {'test.extension': '3.11'}
+ app.extensions['test.extension'] = Extension('test.extension', 'test.extension', version='3.10')
+ with pytest.raises(VersionRequirementError):
+ verify_needs_extensions(app, app.config)