Skip to content

Matplotlib git master version fails to pass several pytest's tests #17310

@hongyi-zhao

Description

@hongyi-zhao

Hi,

The environment is as follows: Ubuntu 19.10, python 3.8.2 managed by pyenv and matplotlib git master version. See the following for the testing steps and results:

$ sudo apt-get build-dep python3-matplotlib python3-matplotlib-venn
$ pip install -e .[dev,extra,all]
$ pytest
========================================== test session starts ==========================================
platform linux -- Python 3.8.2, pytest-5.4.1, py-1.5.4, pluggy-0.13.1
rootdir: /home/werner/Public/hpc/tools/matplotlib.git, inifile: pytest.ini, testpaths: lib
plugins: cov-2.8.1, datadir-1.3.1, regressions-1.0.6, timeout-1.3.4
collected 7591 items     
[...]
================================================ FAILURES =================================================
___________________________________________ test_pdflatex[pdf] ____________________________________________

expected = '/home/werner/Public/hpc/tools/matplotlib.git/result_images/test_backend_pgf/pgf_pdflatex-expected.pdf'
actual = PosixPath('/home/werner/Public/hpc/tools/matplotlib.git/result_images/test_backend_pgf/pgf_pdflatex.pdf')
tol = 0

    def _raise_on_image_difference(expected, actual, tol):
        __tracebackhide__ = True
    
        err = compare_images(expected, actual, tol, in_decorator=True)
        if err:
            for key in ["actual", "expected"]:
                err[key] = os.path.relpath(err[key])
>           raise ImageComparisonFailure(
                'images not close (RMS %(rms).3f):\n\t%(actual)s\n\t%(expected)s '
                 % err)
E           matplotlib.testing.exceptions.ImageComparisonFailure: images not close (RMS 11.669):
E           	result_images/test_backend_pgf/pgf_pdflatex_pdf.png
E           	result_images/test_backend_pgf/pgf_pdflatex-expected_pdf.png

lib/matplotlib/testing/decorators.py:135: ImageComparisonFailure
______________________________________________ test_rcupdate ______________________________________________

    @needs_xelatex
    @needs_pdflatex
    @pytest.mark.skipif(not _has_sfmath(), reason='needs sfmath.sty')
    @pytest.mark.style('default')
    @pytest.mark.backend('pgf')
    def test_rcupdate():
        rc_sets = [{'font.family': 'sans-serif',
                    'font.size': 30,
                    'figure.subplot.left': .2,
                    'lines.markersize': 10,
                    'pgf.rcfonts': False,
                    'pgf.texsystem': 'xelatex'},
                   {'font.family': 'monospace',
                    'font.size': 10,
                    'figure.subplot.left': .1,
                    'lines.markersize': 20,
                    'pgf.rcfonts': False,
                    'pgf.texsystem': 'pdflatex',
                    'pgf.preamble': ('\\usepackage[utf8x]{inputenc}'
                                     '\\usepackage[T1]{fontenc}'
                                     '\\usepackage{sfmath}')}]
        tol = [6, 0]
        for i, rc_set in enumerate(rc_sets):
            with mpl.rc_context(rc_set):
                create_figure()
>               compare_figure('pgf_rcupdate%d.pdf' % (i + 1), tol=tol[i])

lib/matplotlib/tests/test_backend_pgf.py:157: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

fname = 'pgf_rcupdate2.pdf', savefig_kwargs = {}, tol = 0

    def compare_figure(fname, savefig_kwargs={}, tol=0):
        actual = os.path.join(result_dir, fname)
        plt.savefig(actual, **savefig_kwargs)
    
        expected = os.path.join(result_dir, "expected_%s" % fname)
        shutil.copyfile(os.path.join(baseline_dir, fname), expected)
        err = compare_images(expected, actual, tol=tol)
        if err:
>           raise ImageComparisonFailure(err)
E           matplotlib.testing.exceptions.ImageComparisonFailure: Error: Image files did not match.
E             RMS Value: 13.166575390337284
E             Expected:  
E               /home/werner/Public/hpc/tools/matplotlib.git/result_images/test_backend_pgf/expected_pgf_rcupdate2_pdf.png
E             Actual:    
E               /home/werner/Public/hpc/tools/matplotlib.git/result_images/test_backend_pgf/pgf_rcupdate2_pdf.png
E             Difference:
E               /home/werner/Public/hpc/tools/matplotlib.git/result_images/test_backend_pgf/pgf_rcupdate2_pdf-failed-diff.png
E             Tolerance: 
E               0

lib/matplotlib/tests/test_backend_pgf.py:63: ImageComparisonFailure
____________________________________________ test_usetex[png] _____________________________________________

expected = '/home/werner/Public/hpc/tools/matplotlib.git/result_images/test_usetex/test_usetex-expected.png'
actual = PosixPath('/home/werner/Public/hpc/tools/matplotlib.git/result_images/test_usetex/test_usetex.png')
tol = 0

    def _raise_on_image_difference(expected, actual, tol):
        __tracebackhide__ = True
    
        err = compare_images(expected, actual, tol, in_decorator=True)
        if err:
            for key in ["actual", "expected"]:
                err[key] = os.path.relpath(err[key])
>           raise ImageComparisonFailure(
                'images not close (RMS %(rms).3f):\n\t%(actual)s\n\t%(expected)s '
                 % err)
E           matplotlib.testing.exceptions.ImageComparisonFailure: images not close (RMS 12.877):
E           	result_images/test_usetex/test_usetex.png
E           	result_images/test_usetex/test_usetex-expected.png

lib/matplotlib/testing/decorators.py:135: ImageComparisonFailure
========================================= short test summary info =========================================
FAILED lib/matplotlib/tests/test_backend_pgf.py::test_pdflatex[pdf] - matplotlib.testing.exceptions.Imag...
FAILED lib/matplotlib/tests/test_backend_pgf.py::test_rcupdate - matplotlib.testing.exceptions.ImageComp...
FAILED lib/matplotlib/tests/test_usetex.py::test_usetex[png] - matplotlib.testing.exceptions.ImageCompar...
=================== 3 failed, 7517 passed, 60 skipped, 11 xfailed in 630.55s (0:10:30) ====================

Any hints for solving this problems?

Regards

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions