sphinx/tests/test_ext_imgconverter.py
Takeshi KOMIYA 5f56d4146e Fix #9103: LaTeX: imgconverter: conversion runs even if not needed
The imgconverter unexpectedly goes to convert even if the given image
is supported by the target builder when the image globbing is not used.
This enables format guess-ing on not globbed.
2021-04-17 16:51:19 +09:00

30 lines
808 B
Python

"""
test_ext_imgconverter
~~~~~~~~~~~~~~~~~~~~~
Test sphinx.ext.imgconverter extension.
:copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import os
import pytest
@pytest.mark.sphinx('latex', testroot='ext-imgconverter')
@pytest.mark.xfail(os.name != 'posix', reason="Not working on windows")
def test_ext_imgconverter(app, status, warning):
app.builder.build_all()
content = (app.outdir / 'python.tex').read_text()
# supported image (not converted)
assert '\\sphinxincludegraphics{{img}.pdf}' in content
# non supported image (converted)
assert '\\sphinxincludegraphics{{svgimg}.png}' in content
assert not (app.outdir / 'svgimg.svg').exists()
assert (app.outdir / 'svgimg.png').exists()