Fix `test_graphviz_svg_html` on Windows

This commit is contained in:
Adam Turner
2023-08-12 02:57:55 +01:00
parent 4b082f7dbf
commit a392f4d5f4
2 changed files with 10 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
"""Test sphinx.ext.graphviz extension."""
import re
import sys
import pytest
@@ -88,9 +89,14 @@ def test_graphviz_svg_html(app, status, warning):
image_path = image_path_match.group(1)
image_content = (app.outdir / image_path).read_text(encoding='utf8')
assert '"./_static/' not in image_content
assert '<ns0:image ns1:href="../_static/images/test.svg"' in image_content
assert '<ns0:a ns1:href="../_static/images/test.svg"' in image_content
if sys.platform == 'win32':
assert '".\\_static\\' not in image_content
assert r'<ns0:image ns1:href="..\_static\images\test.svg"' in image_content
assert r'<ns0:a ns1:href="..\_static\images\test.svg"' in image_content
else:
assert '"./_static/' not in image_content
assert '<ns0:image ns1:href="../_static/images/test.svg"' in image_content
assert '<ns0:a ns1:href="../_static/images/test.svg"' in image_content
assert '<ns0:a ns1:href="..#graphviz"' in image_content