@@ -293,14 +293,18 @@ In order to enforce that the output is deterministic, you will need to do the fo
293
293
PNG
294
294
^^^
295
295
296
- For PNG files, the output can be made deterministic by setting::
296
+ For PNG files, the output can be made deterministic by setting:
297
+
298
+ .. code :: python
297
299
298
300
@pytest.mark.mpl_image_compare (savefig_kwargs = {' metadata' : {" Software" : None }})
299
301
300
302
PDF
301
303
^^^
302
304
303
- For PDF files, the output can be made deterministic by setting::
305
+ For PDF files, the output can be made deterministic by setting:
306
+
307
+ .. code :: python
304
308
305
309
@pytest.mark.mpl_image_compare (savefig_kwargs = {' format' : ' pdf' ,
306
310
' metadata' : {" Creator" : None ,
@@ -310,13 +314,17 @@ For PDF files, the output can be made deterministic by setting::
310
314
EPS
311
315
^^^
312
316
313
- For PDF files, the output can be made deterministic by setting::
317
+ For PDF files, the output can be made deterministic by setting:
318
+
319
+ .. code :: python
314
320
315
321
@pytest.mark.mpl_image_compare (savefig_kwargs = {' format' : ' pdf' ,
316
322
' metadata' : {" Creator" : " test" })
317
323
318
324
and in addition you will need to set the SOURCE_DATE_EPOCH environment variable to
319
- a constant value (this is a unit timestamp)::
325
+ a constant value (this is a unit timestamp):
326
+
327
+ .. code:: python
320
328
321
329
os.environ[' SOURCE_DATE_EPOCH' ] = ' 1680254601'
322
330
@@ -325,11 +333,15 @@ You could do this inside the test.
325
333
SVG
326
334
^^^
327
335
328
- For SVG files, the output can be made deterministic by setting::
336
+ For SVG files, the output can be made deterministic by setting:
337
+
338
+ .. code:: python
329
339
330
340
@ pytest.mark.mpl_image_compare(savefig_kwargs = {' metadata' : ' {"Date": None}} )
331
341
332
- and in addition, you should make sure the following rcParam is set to a constant string::
342
+ and in addition, you should make sure the following rcParam is set to a constant string:
343
+
344
+ .. code:: python
333
345
334
346
plt.rcParams[' svg.hashsalt' ] = ' test'
335
347
0 commit comments