mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Run LaTeX in testing: don't skip the test unless all latexes do not exist
Until now when one of the 3 latexes (pdflatex, xelatex, lualatex) does not exist, the test was skipped. This commit changes the behavior to "unless none of the 3 latexes exists, don't skip the test".
This commit is contained in:
parent
6b36b31984
commit
875e6a503b
@ -38,14 +38,16 @@ def run_latex(outdir):
|
|||||||
cwd = os.getcwd()
|
cwd = os.getcwd()
|
||||||
os.chdir(outdir)
|
os.chdir(outdir)
|
||||||
try:
|
try:
|
||||||
for latex in ('pdflatex', 'xelatex', 'lualatex'):
|
latexes = ('pdflatex', 'xelatex', 'lualatex')
|
||||||
|
available_latexes = len(latexes)
|
||||||
|
for latex in latexes:
|
||||||
try:
|
try:
|
||||||
os.mkdir(latex)
|
os.mkdir(latex)
|
||||||
p = Popen([latex, '--interaction=nonstopmode',
|
p = Popen([latex, '--interaction=nonstopmode',
|
||||||
'-output-directory=%s' % latex, 'SphinxTests.tex'],
|
'-output-directory=%s' % latex, 'SphinxTests.tex'],
|
||||||
stdout=PIPE, stderr=PIPE)
|
stdout=PIPE, stderr=PIPE)
|
||||||
except OSError:
|
except OSError: # most likely the latex executable was not found
|
||||||
raise SkipTest # most likely pdflatex was not found
|
available_latexes -= 1
|
||||||
else:
|
else:
|
||||||
stdout, stderr = p.communicate()
|
stdout, stderr = p.communicate()
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
@ -56,6 +58,9 @@ def run_latex(outdir):
|
|||||||
finally:
|
finally:
|
||||||
os.chdir(cwd)
|
os.chdir(cwd)
|
||||||
|
|
||||||
|
if available_latexes == 0: # no latex is available, skip the test
|
||||||
|
raise SkipTest
|
||||||
|
|
||||||
@with_app(buildername='latex', freshenv=True) # use freshenv to check warnings
|
@with_app(buildername='latex', freshenv=True) # use freshenv to check warnings
|
||||||
def test_latex(app, status, warning):
|
def test_latex(app, status, warning):
|
||||||
LaTeXTranslator.ignore_missing_images = True
|
LaTeXTranslator.ignore_missing_images = True
|
||||||
|
Loading…
Reference in New Issue
Block a user