Skip to content

Commit

Permalink
Backport PR matplotlib#26431: MNT: Unpin pyparsing, xfail error messa…
Browse files Browse the repository at this point in the history
…ge tests for pyparsing 3.1.0
  • Loading branch information
jklymak authored and meeseeksmachine committed Aug 1, 2023
1 parent 2e6570a commit c518378
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencies:
- pillow>=6.2
- pybind11>=2.6.0
- pygobject
- pyparsing!=3.1.0
- pyparsing>=2.3.1
- pyqt
- python-dateutil>=2.1
- setuptools
Expand Down
8 changes: 8 additions & 0 deletions lib/matplotlib/tests/test_mathtext.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@
from xml.etree import ElementTree as ET

import numpy as np
from packaging.version import parse as parse_version
import pyparsing
import pytest


import matplotlib as mpl
from matplotlib.testing.decorators import check_figures_equal, image_comparison
import matplotlib.pyplot as plt
from matplotlib import mathtext, _mathtext

pyparsing_version = parse_version(pyparsing.__version__)


# If test is removed, use None as placeholder
math_tests = [
Expand Down Expand Up @@ -270,6 +275,9 @@ def test_fontinfo():
assert table['version'] == (1, 0)


# See gh-26152 for more context on this xfail
@pytest.mark.xfail(pyparsing_version.release == (3, 1, 0),
reason="Error messages are incorrect for this version")
@pytest.mark.parametrize(
'math, msg',
[
Expand Down
10 changes: 10 additions & 0 deletions lib/matplotlib/tests/test_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

import numpy as np
from numpy.testing import assert_almost_equal
from packaging.version import parse as parse_version
import pyparsing
import pytest

import matplotlib as mpl
Expand All @@ -16,6 +18,8 @@
from matplotlib.testing._markers import needs_usetex
from matplotlib.text import Text

pyparsing_version = parse_version(pyparsing.__version__)


@image_comparison(['font_styles'])
def test_font_styles():
Expand Down Expand Up @@ -809,6 +813,9 @@ def test_unsupported_script(recwarn):
(r"Matplotlib currently does not support Bengali natively.",)])


# See gh-26152 for more information on this xfail
@pytest.mark.xfail(pyparsing_version.release == (3, 1, 0),
reason="Error messages are incorrect with pyparsing 3.1.0")
def test_parse_math():
fig, ax = plt.subplots()
ax.text(0, 0, r"$ \wrong{math} $", parse_math=False)
Expand All @@ -819,6 +826,9 @@ def test_parse_math():
fig.canvas.draw()


# See gh-26152 for more information on this xfail
@pytest.mark.xfail(pyparsing_version.release == (3, 1, 0),
reason="Error messages are incorrect with pyparsing 3.1.0")
def test_parse_math_rcparams():
# Default is True
fig, ax = plt.subplots()
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def make_release_tree(self, base_dir, files):
"numpy>=1.20",
"packaging>=20.0",
"pillow>=6.2.0",
"pyparsing>=2.3.1,<3.1",
"pyparsing>=2.3.1",
"python-dateutil>=2.7",
] + (
# Installing from a git checkout that is not producing a wheel.
Expand Down

0 comments on commit c518378

Please sign in to comment.