Skip to content

Commit 0accea9

Browse files
committed
Fix tests with newer alabaster versions.
1 parent def9a6b commit 0accea9

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

tests/test_output/test_output.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,36 @@
11
# stdlib
22
import random
3-
import re
3+
from typing import Tuple, no_type_check
44

55
# 3rd party
66
import pytest
77
from bs4 import BeautifulSoup # type: ignore
8-
from coincidence.regressions import AdvancedFileRegressionFixture
98
from domdf_python_tools.paths import PathPlus
109
from domdf_python_tools.stringlist import StringList
11-
from sphinx_toolbox.testing import HTMLRegressionFixture, LaTeXRegressionFixture, check_html_regression
10+
from sphinx_toolbox.testing import HTMLRegressionFixture, LaTeXRegressionFixture
1211

1312

1413
def test_build_example(app):
1514
app.build()
1615
app.build()
1716

1817

18+
@no_type_check
19+
def _get_alabaster_version() -> Tuple[int, int, int]:
20+
try:
21+
# 3rd party
22+
import alabaster._version as alabaster # type: ignore[import]
23+
except ImportError:
24+
# 3rd party
25+
import alabaster # type: ignore[import]
26+
27+
return tuple(map(int, alabaster.__version__.split('.')))
28+
29+
1930
@pytest.mark.sphinx("html", srcdir="test-root")
2031
@pytest.mark.parametrize("page", ["index.html"], indirect=True)
2132
def test_html_output(page: BeautifulSoup, html_regression: HTMLRegressionFixture):
22-
html_regression.check(page, jinja2=True)
33+
html_regression.check(page, jinja2=True, jinja2_namespace={"alabaster_version": _get_alabaster_version()})
2334

2435

2536
@pytest.mark.sphinx("latex", srcdir="test-root")

tests/test_output/test_output_/test_html_output_index_html_.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
<script src="_static/underscore.js">
1919
</script>
2020
<script src="_static/doctools.js">
21-
</script>
22-
<meta content="width=device-width, initial-scale=0.9, maximum-scale=0.9" name="viewport"/>
21+
</script>{% if alabaster_version < (0, 7, 15) %}
22+
<meta content="width=device-width, initial-scale=0.9, maximum-scale=0.9" name="viewport"/>{% endif %}
2323
</head>
2424
<body>
2525
<div class="document">

tox.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ filterwarnings =
247247
always:The frontend.Option class will be removed in Docutils 0.21 or later.:DeprecationWarning
248248
always:importlib.resources.contents is deprecated. Use files:DeprecationWarning
249249
always:The `docutils.parsers.rst.directive.html` module will be removed in Docutils 1.2.:DeprecationWarning
250+
always::FutureWarning
250251
markers = sphinx
251252
252253
[testenv:py312-sphinx{3.2,3.3,3.4,3.5}]

0 commit comments

Comments
 (0)