File tree Expand file tree Collapse file tree 2 files changed +23
-4
lines changed
Filter options
Expand file tree Collapse file tree 2 files changed +23
-4
lines changed
Original file line number Diff line number Diff line change
1
+ import os
1
2
from pathlib import Path
2
3
import re
4
+ import subprocess
5
+ import sys
3
6
4
7
import matplotlib .pyplot as plt
5
8
from matplotlib .texmanager import TexManager
@@ -57,3 +60,15 @@ def test_unicode_characters():
57
60
with pytest .raises (RuntimeError ):
58
61
ax .set_title ('\N{SNOWMAN} ' )
59
62
fig .canvas .draw ()
63
+
64
+
65
+ @needs_usetex
66
+ def test_openin_any_paranoid ():
67
+ completed = subprocess .run (
68
+ [sys .executable , "-c" ,
69
+ 'import matplotlib.pyplot as plt;'
70
+ 'plt.rcParams.update({"text.usetex": True});'
71
+ 'plt.title("paranoid");'
72
+ 'plt.show(block=False);' ],
73
+ env = {** os .environ , 'openin_any' : 'p' }, check = True , capture_output = True )
74
+ assert completed .stderr == b""
Original file line number Diff line number Diff line change @@ -291,12 +291,16 @@ def make_dvi(cls, tex, fontsize):
291
291
# and thus replace() works atomically. It also allows referring to
292
292
# the texfile with a relative path (for pathological MPLCONFIGDIRs,
293
293
# the absolute path may contain characters (e.g. ~) that TeX does
294
- # not support.)
295
- with TemporaryDirectory (dir = Path (dvifile ).parent ) as tmpdir :
294
+ # not support; n.b. relative paths cannot traverse parents, or it
295
+ # will be blocked when `openin_any = p` in texmf.cnf).
296
+ cwd = Path (dvifile ).parent
297
+ with TemporaryDirectory (dir = cwd ) as tmpdir :
298
+ tmppath = Path (tmpdir )
296
299
cls ._run_checked_subprocess (
297
300
["latex" , "-interaction=nonstopmode" , "--halt-on-error" ,
298
- f"../{ texfile .name } " ], tex , cwd = tmpdir )
299
- (Path (tmpdir ) / Path (dvifile ).name ).replace (dvifile )
301
+ f"--output-directory={ tmppath .name } " ,
302
+ f"{ texfile .name } " ], tex , cwd = cwd )
303
+ (tmppath / Path (dvifile ).name ).replace (dvifile )
300
304
return dvifile
301
305
302
306
@classmethod
You can’t perform that action at this time.
0 commit comments