From b6e6805f80ad530231cf841e689498005cf2bb96 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Thu, 13 Apr 2023 06:15:50 +0200 Subject: [PATCH] test_build_latex: move output to a separate output dir MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Related: #11285 Co-authored-by: Jean-François B <2589111+jfbu@users.noreply.github.com> --- tests/test_build_latex.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/test_build_latex.py b/tests/test_build_latex.py index 8c6ecb96a30..7fb59dbc983 100644 --- a/tests/test_build_latex.py +++ b/tests/test_build_latex.py @@ -27,7 +27,7 @@ from sphinx.util.osutil import _chdir as chdir LATEX_ENGINES = ['pdflatex', 'lualatex', 'xelatex'] -DOCCLASSES = ['howto', 'manual'] +DOCCLASSES = ['manual', 'howto'] STYLEFILES = ['article.cls', 'fancyhdr.sty', 'titlesec.sty', 'amsmath.sty', 'framed.sty', 'color.sty', 'fancyvrb.sty', 'fncychap.sty', 'geometry.sty', 'kvoptions.sty', 'hyperref.sty', @@ -51,17 +51,20 @@ def kpsetest(*filenames): # compile latex document with app.config.latex_engine -def compile_latex_document(app, filename='python.tex'): +def compile_latex_document(app, filename='python.tex', docclass='manual'): # now, try to run latex over it try: with chdir(app.outdir): - ensuredir(app.config.latex_engine) + # name latex output-directory according to both engine and docclass + # to avoid reuse of auxiliary files by one docclass from another + latex_outputdir = app.config.latex_engine + docclass + ensuredir(latex_outputdir) # keep a copy of latex file for this engine in case test fails - copyfile(filename, app.config.latex_engine + '/' + filename) + copyfile(filename, latex_outputdir + '/' + filename) args = [app.config.latex_engine, '--halt-on-error', '--interaction=nonstopmode', - '-output-directory=%s' % app.config.latex_engine, + '-output-directory=%s' % latex_outputdir, filename] subprocess.run(args, capture_output=True, check=True) except OSError as exc: # most likely the latex executable was not found @@ -117,7 +120,7 @@ def test_build_latex_doc(app, status, warning, engine, docclass): # file from latex_additional_files assert (app.outdir / 'svgimg.svg').isfile() - compile_latex_document(app, 'sphinxtests.tex') + compile_latex_document(app, 'sphinxtests.tex', docclass) @pytest.mark.sphinx('latex')