Skip to content

Commit

Permalink
Add TEXINPUTS related test
Browse files Browse the repository at this point in the history
  • Loading branch information
tuncbkose committed Jun 9, 2023
1 parent 366d65a commit 44452b4
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions nbconvert/exporters/tests/test_pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from tempfile import TemporaryDirectory

from ...tests.utils import onlyif_cmds_exist
from ...utils import _contextlib_chdir
from ..pdf import PDFExporter
from .base import ExportersTestsBase

Expand Down Expand Up @@ -39,3 +40,24 @@ def test_export(self):
assert len(output) > 0
# all temporary file should be cleaned up
assert {file_name} == set(os.listdir(td))

@onlyif_cmds_exist("xelatex", "pandoc")
def test_texinputs(self):
"""
Is TEXINPUTS set properly when we are converting
- in the same directory, and
- in a different directory?
"""
with TemporaryDirectory() as td, _contextlib_chdir.chdir(td):
os.mkdir("folder")
file_name = os.path.basename(self._get_notebook())
nb1 = os.path.join(td, file_name)
nb2 = os.path.join(td, "folder", file_name)
ex1 = self.exporter_class(latex_count=1) # type:ignore
ex2 = self.exporter_class(latex_count=1) # type:ignore
shutil.copy(self._get_notebook(), nb1)
shutil.copy(self._get_notebook(), nb2)
_ = ex1.from_filename(nb1)
_ = ex2.from_filename(nb2)
assert ex1.texinputs == os.path.abspath(".")
assert ex2.texinputs == os.path.abspath("./folder")

0 comments on commit 44452b4

Please sign in to comment.