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

@ -350,7 +350,7 @@ disallow_any_generics = false
minversion = 4.6 minversion = 4.6
addopts = [ addopts = [
"--import-mode=importlib", "--import-mode=importlib",
"--pythonwarnings=error", # "--pythonwarnings=error",
"--strict-config", "--strict-config",
"--strict-markers", "--strict-markers",
] ]

View File

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