9
9
10
10
import matplotlib as mpl
11
11
import matplotlib .pyplot as plt
12
- from matplotlib .testing import _has_tex_package , _check_for_pgf
13
- from matplotlib .testing .compare import compare_images , ImageComparisonFailure
14
12
from matplotlib .backends .backend_pgf import FigureCanvasPgf , PdfPages
13
+ from matplotlib .backends .backend_pdf import FigureCanvasPdf
14
+ from matplotlib .testing import _has_tex_package , _check_for_pgf
15
+ from matplotlib .testing .compare import compare_images
16
+ from matplotlib .testing .exceptions import ImageComparisonFailure
15
17
from matplotlib .testing .decorators import (
16
18
_image_directories , check_figures_equal , image_comparison )
17
19
from matplotlib .testing ._markers import (
@@ -377,7 +379,6 @@ def test_sketch_params():
377
379
assert baseline in buf
378
380
379
381
380
- < << << << HEAD
381
382
# test to make sure that the document font size is set consistently (see #26892)
382
383
@needs_pgf_xelatex
383
384
@pytest .mark .skipif (
@@ -400,13 +401,24 @@ def test_document_font_size():
400
401
label = r'\normalsize the document font size is \the\fontdimen6\font'
401
402
)
402
403
plt .legend ()
403
- == == == =
404
+
405
+
8000
404
406
@needs_pgf_xelatex
405
407
@pytest .mark .backend ('pgf' )
406
- @image_comparison (['hatch_linewidth' ], extensions = ['pdf' ])
407
408
def test_pgf_hatch_linewidth ():
408
409
mpl .backend_bases .register_backend ('pdf' , FigureCanvasPgf )
409
410
mpl .rcParams ['hatch.linewidth' ] = 0.1
410
411
411
412
plt .bar (1 , 1 , color = 'white' , edgecolor = 'black' , hatch = '/' )
412
- > >> >> >> 7 cbcd44f9a (Fix hatch linewidth in PGF )
413
+ error = None
414
+ try :
415
+ compare_figure ('hatch_linewidth.pdf' )
416
+ except ImageComparisonFailure as e :
417
+ # Store if error
418
+ error = e
419
+ # Restore backend to not mess up other tests
420
+ mpl .backend_bases .register_backend ('pdf' , FigureCanvasPdf )
421
+
422
+ if error is not None :
423
+ # Re-raise stored error
424
+ raise error
0 commit comments