summaryrefslogtreecommitdiff
path: root/tests/test_build_latex.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2019-02-03 23:54:22 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2019-02-03 23:54:22 +0900
commit7b1755d21bcc5e16c4d9256ff0a8849730ff1091 (patch)
treebf299e2a375e1385aaa63782ed33245eb3a829fd /tests/test_build_latex.py
parentb40ad9ffd49bf715a599146a90c1bea3395b921f (diff)
downloadsphinx-git-7b1755d21bcc5e16c4d9256ff0a8849730ff1091.tar.gz
Fix test: compile_latex_document()
Diffstat (limited to 'tests/test_build_latex.py')
-rw-r--r--tests/test_build_latex.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/tests/test_build_latex.py b/tests/test_build_latex.py
index 2ce63ae6a..3a31fa586 100644
--- a/tests/test_build_latex.py
+++ b/tests/test_build_latex.py
@@ -23,7 +23,7 @@ from sphinx.config import Config
from sphinx.errors import SphinxError
from sphinx.testing.util import strip_escseq
from sphinx.util import docutils
-from sphinx.util.osutil import ensuredir
+from sphinx.util.osutil import cd, ensuredir
from sphinx.writers.latex import LaTeXTranslator
@@ -54,15 +54,16 @@ def kpsetest(*filenames):
def compile_latex_document(app, filename='python.tex'):
# now, try to run latex over it
try:
- ensuredir(app.config.latex_engine)
- # keep a copy of latex file for this engine in case test fails
- copyfile(filename, app.config.latex_engine + '/' + filename)
- args = [app.config.latex_engine,
- '--halt-on-error',
- '--interaction=nonstopmode',
- '-output-directory=%s' % app.config.latex_engine,
- filename]
- subprocess.run(args, stdout=PIPE, stderr=PIPE, cwd=app.outdir, check=True)
+ with cd(app.outdir):
+ ensuredir(app.config.latex_engine)
+ # keep a copy of latex file for this engine in case test fails
+ copyfile(filename, app.config.latex_engine + '/' + filename)
+ args = [app.config.latex_engine,
+ '--halt-on-error',
+ '--interaction=nonstopmode',
+ '-output-directory=%s' % app.config.latex_engine,
+ filename]
+ subprocess.run(args, stdout=PIPE, stderr=PIPE, check=True)
except OSError: # most likely the latex executable was not found
raise pytest.skip.Exception
except CalledProcessError as exc: