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