5
5
import numpy as np
6
6
import pytest
7
7
8
- from manim import MathTex , SingleStringMathTex , Tex , TexTemplate , config , tempconfig
8
+ from manim import MathTex , SingleStringMathTex , Tex , TexTemplate , tempconfig
9
9
10
10
11
- def test_MathTex ():
11
+ def test_MathTex (config ):
12
12
MathTex ("a^2 + b^2 = c^2" )
13
13
assert Path (config .media_dir , "Tex" , "e4be163a00cf424f.svg" ).exists ()
14
14
15
15
16
- def test_SingleStringMathTex ():
16
+ def test_SingleStringMathTex (config ):
17
17
SingleStringMathTex ("test" )
18
18
assert Path (config .media_dir , "Tex" , "8ce17c7f5013209f.svg" ).exists ()
19
19
@@ -27,7 +27,7 @@ def test_double_braces_testing(text_input, length_sub):
27
27
assert len (t1 .submobjects ) == length_sub
28
28
29
29
30
- def test_tex ():
30
+ def test_tex (config ):
31
31
Tex ("The horse does not eat cucumber salad." )
32
32
assert Path (config .media_dir , "Tex" , "c3945e23e546c95a.svg" ).exists ()
33
33
@@ -45,7 +45,7 @@ def test_tex_temp_directory(tmpdir, monkeypatch):
45
45
assert Path ("media" , "Tex" , "c3945e23e546c95a.svg" ).exists ()
46
46
47
47
48
- def test_percent_char_rendering ():
48
+ def test_percent_char_rendering (config ):
49
49
Tex (r"\%" )
50
50
assert Path (config .media_dir , "Tex" , "4a583af4d19a3adf.tex" ).exists ()
51
51
@@ -194,33 +194,33 @@ def test_error_in_nested_context(capsys):
194
194
\end{align}
195
195
"""
196
196
197
- with pytest .raises (ValueError ) as err :
197
+ with pytest .raises (ValueError ):
198
198
Tex (invalid_tex )
199
199
200
200
stdout = str (capsys .readouterr ().out )
201
201
# validate useless context is not included
202
202
assert r"\begin{frame}" not in stdout
203
203
204
204
205
- def test_tempconfig_resetting_tex_template ():
205
+ def test_tempconfig_resetting_tex_template (config ):
206
206
my_template = TexTemplate ()
207
207
my_template .preamble = "Custom preamble!"
208
- tex_template_config_value = config .tex_template
209
208
with tempconfig ({"tex_template" : my_template }):
210
209
assert config .tex_template .preamble == "Custom preamble!"
211
210
212
211
assert config .tex_template .preamble != "Custom preamble!"
213
212
214
213
215
- def test_tex_garbage_collection (tmpdir , monkeypatch ):
214
+ def test_tex_garbage_collection (tmpdir , monkeypatch , config ):
216
215
monkeypatch .chdir (tmpdir )
217
216
Path (tmpdir , "media" ).mkdir ()
217
+ config .media_dir = "media"
218
218
219
- with tempconfig ({"media_dir" : "media" }):
220
- tex_without_log = Tex ("Hello World!" ) # d771330b76d29ffb.tex
221
- assert Path ("media" , "Tex" , "d771330b76d29ffb.tex" ).exists ()
222
- assert not Path ("media" , "Tex" , "d771330b76d29ffb.log" ).exists ()
219
+ tex_without_log = Tex ("Hello World!" ) # d771330b76d29ffb.tex
220
+ assert Path ("media" , "Tex" , "d771330b76d29ffb.tex" ).exists ()
221
+ assert not Path ("media" , "Tex" , "d771330b76d29ffb.log" ).exists ()
222
+
223
+ config .no_latex_cleanup = True
223
224
224
- with tempconfig ({"media_dir" : "media" , "no_latex_cleanup" : True }):
225
- tex_with_log = Tex ("Hello World, again!" ) # da27670a37b08799.tex
226
- assert Path ("media" , "Tex" , "da27670a37b08799.log" ).exists ()
225
+ tex_with_log = Tex ("Hello World, again!" ) # da27670a37b08799.tex
226
+ assert Path ("media" , "Tex" , "da27670a37b08799.log" ).exists ()
0 commit comments