8000 TST: Add future dependency tests as a weekly CI job · matplotlib/matplotlib@4cf54f4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4cf54f4

Browse files
committed
TST: Add future dependency tests as a weekly CI job
Test future numpy and pandas versions with Matplotlib to see if anything needs to be done in the future to address deprecations or other pending changes. Turns all warnings into errors, but filters out the distutils deprecation and find_spec warnings.
1 parent 4359e3a commit 4cf54f4

File tree

3 files changed

+38
-3
lines changed

3 files changed

+38
-3
lines changed

.github/workflows/tests.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
pull_request:
99
branches-ignore:
1010
- v[0-9]+.[0-9]+.[0-9x]+-doc
11+
schedule:
12+
# 3:47 UTC on Saturdays
13+
- cron: "47 3 * * 6"
1114

1215
env:
1316
NO_AT_BRIDGE: 1 # Necessary for GTK3 interactive test.
@@ -209,6 +212,20 @@ jobs:
209212
echo 'wxPython is available' ||
210213
echo 'wxPython is not available'
211214
215+
- name: Install the nightly dependencies
216+
# Only install the nightly dependencies during the scheduled event
217+
if: ${{ github.event_name == 'schedule' && matrix.name-suffix != '(Minimum Versions)' }}
218+
run: |
219+
python -m pip install -i https://pypi.anaconda.org/scipy-wheels-nightly/simple --upgrade numpy pandas
220+
221+
# Turn all warnings to errors, except ignore the distutils deprecations and the find_spec warning
222+
cat >> pytest.ini << EOF
223+
filterwarnings =
224+
error
225+
ignore:.*distutils:DeprecationWarning
226+
ignore:DynamicImporter.find_spec\(\) not found; falling back to find_module\(\):ImportWarning
227+
EOF
228+
212229
- name: Install Matplotlib
213230
run: |
214231
ccache -s
@@ -266,3 +283,18 @@ jobs:
266283
with:
267284
name: "${{ matrix.python-version }} ${{ matrix.os }} ${{ matrix.name-suffix }} result images"
268285
path: ./result_images
286+
287+
- name: Create issue on failure
288+
uses: imjohnbo/issue-bot@v3
289+
if: ${{ failure() && github.event_name == 'schedule' }}
290+
with:
291+
title: "[TST] Upcoming dependency test failures"
292+
body: |
293+
The weekly build with nightly wheels from numpy and pandas
294+
has failed. Check the logs for any updates that need to be
295+
made in matplotlib.
296+
297+
pinned: false
298+
close-previous: false
299+
env:
300+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

lib/matplotlib/tests/test_axes.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3438,6 +3438,8 @@ def test_errorbar():
34383438
ax.errorbar(x, y, yerr=[yerr_lower, 2*yerr], xerr=xerr,
34393439
fmt='o', ecolor='g', capthick=2)
34403440
ax.set_title('Mixed sym., log y')
3441+
# Force limits due to floating point slop potentially expanding the range
3442+
ax.set_ylim(1e-2, 1e1)
34413443

34423444
fig.suptitle('Variable errorbars')
34433445

lib/matplotlib/tests/test_colors.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -568,14 +568,15 @@ def test_Normalize():
568568
# Don't lose precision on longdoubles (float128 on Linux):
569569
# for array inputs...
570570
vals = np.array([1.2345678901, 9.8765432109], dtype=np.longdouble)
571-
norm = mcolors.Normalize(vals.min(), vals.max())
572-
assert_array_equal(np.asarray(norm(vals)), [0, 1])
571+
norm = mcolors.Normalize(vals[0], vals[1])
572+
assert norm(vals).dtype == np.longdouble
573+
assert_array_equal(norm(vals), [0, 1])
573574
# and for scalar ones.
574575
eps = np.finfo(np.longdouble).resolution
575576
norm = plt.Normalize(1, 1 + 100 * eps)
576577
# This returns exactly 0.5 when longdouble is extended precision (80-bit),
577578
# but only a value close to it when it is quadruple precision (128-bit).
578-
assert 0 < norm(1 + 50 * eps) < 1
579+
np.testing.assert_array_almost_equal_nulp(norm(1 + 50 * eps), 0.5)
579580

580581

581582
def test_FuncNorm():

0 commit comments

Comments
 (0)
0