@@ -55,7 +55,10 @@ def kpsetest(*filenames):
55
55
56
56
57
57
# compile latex document with app.config.latex_engine
58
- def compile_latex_document (app , filename = 'projectnamenotset.tex' , docclass = 'manual' ):
58
+ def compile_latex_document (app ,
59
+ filename = 'projectnamenotset.tex' ,
60
+ docclass = 'manual' ,
61
+ runtwice = False ):
59
62
# now, try to run latex over it
60
63
try :
61
64
with chdir (app .outdir ):
@@ -82,7 +85,7 @@ def compile_latex_document(app, filename='projectnamenotset.tex', docclass='manu
82
85
# as configured in the Makefile and in presence of latexmkrc
83
86
# or latexmkjarc and also sphinx.xdy and other xindy support.
84
87
# And two passes are not enough except for simplest documents.
85
- if app . config . latex_engine == 'pdflatex' :
88
+ if runtwice :
86
89
subprocess .run (args , capture_output = True , check = True )
87
90
except OSError as exc : # most likely the latex executable was not found
88
91
raise pytest .skip .Exception from exc
@@ -101,6 +104,10 @@ def compile_latex_document(app, filename='projectnamenotset.tex', docclass='manu
101
104
not kpsetest (* STYLEFILES ),
102
105
reason = 'not running latex, the required styles do not seem to be installed' ,
103
106
)
107
+ skip_if_docutils_not_at_least_at_0_22 = pytest .mark .skipif (
108
+ docutils .__version_info__ [:2 ] < (0 , 22 ),
109
+ reason = 'this test requires Docutils at least at 0.22' ,
110
+ )
104
111
105
112
106
113
class RemoteImageHandler (http .server .BaseHTTPRequestHandler ):
@@ -128,25 +135,29 @@ def do_GET(self):
128
135
@skip_if_requested
129
136
@skip_if_stylefiles_notfound
130
137
@pytest .mark .parametrize (
131
- ('engine' , 'docclass' , 'python_maximum_signature_line_length' ),
138
+ ('engine' , 'docclass' , 'python_maximum_signature_line_length' , 'runtwice' ),
132
139
# Only running test with `python_maximum_signature_line_length` not None with last
133
140
# LaTeX engine to reduce testing time, as if this configuration does not fail with
134
141
# one engine, it's almost impossible it would fail with another.
135
142
[
136
- ('pdflatex' , 'manual' , None ),
137
- ('pdflatex' , 'howto' , None ),
138
- ('lualatex' , 'manual' , None ),
139
- ('lualatex' , 'howto' , None ),
140
- ('xelatex' , 'manual' , 1 ),
141
- ('xelatex' , 'howto' , 1 ),
143
+ ('pdflatex' , 'manual' , None , True ),
144
+ ('pdflatex' , 'howto' , None , True ),
145
+ ('lualatex' , 'manual' , None , False ),
146
+ ('lualatex' , 'howto' , None , False ),
147
+ ('xelatex' , 'manual' , 1 , False ),
148
+ ('xelatex' , 'howto' , 1 , False ),
142
149
],
143
150
)
144
151
@pytest .mark .sphinx (
145
152
'latex' ,
146
153
testroot = 'root' ,
147
154
freshenv = True ,
148
155
)
149
- def test_build_latex_doc (app , engine , docclass , python_maximum_signature_line_length ):
156
+ def test_build_latex_doc (app ,
157
+ engine ,
158
+ docclass ,
159
+ python_maximum_signature_line_length ,
160
+ runtwice ):
150
161
app .config .python_maximum_signature_line_length = (
151
162
python_maximum_signature_line_length
152
163
)
@@ -170,7 +181,25 @@ def test_build_latex_doc(app, engine, docclass, python_maximum_signature_line_le
170
181
# file from latex_additional_files
171
182
assert (app .outdir / 'svgimg.svg' ).is_file ()
172
183
173
- compile_latex_document (app , 'sphinxtests.tex' , docclass )
184
+ compile_latex_document (app , 'sphinxtests.tex' , docclass , runtwice )
185
+
186
+
187
+ @skip_if_requested
188
+ @skip_if_stylefiles_notfound
189
+ @skip_if_docutils_not_at_least_at_0_22
190
+ @pytest .mark .parametrize (
191
+ 'engine' , ['pdflatex' , 'lualatex' , 'xelatex' ]
192
+ )
193
+ @pytest .mark .sphinx (
194
+ 'latex' ,
195
+ testroot = 'latex-images-css3-lengths' ,
196
+ )
197
+ def test_build_latex_with_css3_lengths (app , engine ):
198
+ app .config .latex_engine = engine
199
+ app .config .latex_documents = [(* app .config .latex_documents [0 ][:4 ], 'howto' )]
200
+ app .builder .init ()
201
+ app .build (force_all = True )
202
+ compile_latex_document (app , docclass = 'howto' )
174
203
175
204
176
205
@pytest .mark .sphinx ('latex' , testroot = 'root' )
0 commit comments