Skip to content

Commit

Permalink
Tests: test_latex_images: match against test HTTP server address.
Browse files Browse the repository at this point in the history
  • Loading branch information
jayaddison committed Apr 9, 2024
1 parent 514ad2e commit fb23eff
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/test_builders/test_build_latex.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from sphinx.util.osutil import ensuredir
from sphinx.writers.latex import LaTeXTranslator

from tests.utils import http_server
from tests.utils import http_server, serve_application

try:
from contextlib import chdir
Expand Down Expand Up @@ -1427,7 +1427,7 @@ def test_latex_raw_directive(app, status, warning):
@pytest.mark.usefixtures('if_online')
@pytest.mark.sphinx('latex', testroot='images')
def test_latex_images(app, status, warning):
with http_server(RemoteImageHandler):
with serve_application(app, RemoteImageHandler) as address:
app.build(force_all=True)

result = (app.outdir / 'python.tex').read_text(encoding='utf8')
Expand All @@ -1439,7 +1439,7 @@ def test_latex_images(app, status, warning):
# not found images
assert '\\sphinxincludegraphics{{NOT_EXIST}.PNG}' not in result
assert ('WARNING: Could not fetch remote image: '
'https://localhost:7777/NOT_EXIST.PNG [404]' in warning.getvalue())
f'https://{address}/NOT_EXIST.PNG [404]' in warning.getvalue())

# an image having target
assert ('\\sphinxhref{https://www.sphinx-doc.org/}'
Expand Down

0 comments on commit fb23eff

Please sign in to comment.