Skip to content

Commit cb18ce9

Browse files
committed
Fix tests with newer alabaster versions.
1 parent 12ec80b commit cb18ce9

File tree

4 files changed

+20
-6
lines changed

4 files changed

+20
-6
lines changed

tests/test_directive.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# stdlib
22
import os
33
from pathlib import Path
4-
from typing import Any, Iterator
4+
from typing import Any, Iterator, Tuple, no_type_check
55

66
# 3rd party
77
import pytest
@@ -101,4 +101,16 @@ def test_output(
101101
div["src"] = div["src"].split("?v=")[0]
102102
print(div["src"])
103103

104-
html_regression.check(page, jinja2=True)
104+
html_regression.check(page, jinja2=True, jinja2_namespace={"alabaster_version": _get_alabaster_version()})
105+
106+
107+
@no_type_check
108+
def _get_alabaster_version() -> Tuple[int, int, int]:
109+
try:
110+
# 3rd party
111+
import alabaster._version as alabaster # type: ignore[import]
112+
except ImportError:
113+
# 3rd party
114+
import alabaster # type: ignore[import]
115+
116+
return tuple(map(int, alabaster.__version__.split('.')))

tests/test_directive_/test_output_36_index_html_.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
<script src="_static/_sphinx_javascript_frameworks_compat.js">
2929
</script>{% endif %}
3030
<script src="_static/doctools.js">
31-
</script>
32-
<meta content="width=device-width, initial-scale=0.9, maximum-scale=0.9" name="viewport"/>
31+
</script>{% if alabaster_version < (0, 7, 15) %}
32+
<meta content="width=device-width, initial-scale=0.9, maximum-scale=0.9" name="viewport"/>{% endif %}
3333
</head>
3434
<body>
3535
<div class="document">

tests/test_directive_/test_output_36_pypy_index_html_.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
<script src="_static/_sphinx_javascript_frameworks_compat.js">
2929
</script>{% endif %}
3030
<script src="_static/doctools.js">
31-
</script>
32-
<meta content="width=device-width, initial-scale=0.9, maximum-scale=0.9" name="viewport"/>
31+
</script>{% if alabaster_version < (0, 7, 15) %}
32+
<meta content="width=device-width, initial-scale=0.9, maximum-scale=0.9" name="viewport"/>{% endif %}
3333
</head>
3434
<body>
3535
<div class="document">

tox.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,8 @@ filterwarnings =
247247
always:datetime.datetime.utcfromtimestamp\(\) is deprecated and scheduled for removal in a future version.:DeprecationWarning:sphinx.builders.gettext
248248
always:The alias 'sphinx.util.SkipProgressMessage' is deprecated, use 'sphinx.util.display.SkipProgressMessage' instead:DeprecationWarning:sphinxcontrib.applehelp
249249
always:The alias 'sphinx.util.progress_message' is deprecated, use 'sphinx.http_date.epoch_to_rfc1123' instead.:DeprecationWarning:sphinxcontrib.applehelp
250+
always:The alias 'sphinx.util.typing.stringify' is deprecated, use 'sphinx.util.typing.stringify_annotation' instead. Check CHANGES for Sphinx API modifications.:DeprecationWarning
251+
250252
markers = sphinx
251253
252254
[testenv:py312-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1}]

0 commit comments

Comments
 (0)