Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7830c85

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 075067c commit 7830c85

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.
@@ -213,6 +216,20 @@ jobs:
213216
echo 'wxPython is available' ||
214217
echo 'wxPython is not available'
215218
219+
- name: Install the nightly dependencies
220+
# Only install the nightly dependencies during the scheduled event
221+
if: ${{ github.event_name == 'schedule' && matrix.name-suffix != '(Minimum Versions)' }}
222+
run: |
223+
python -m pip install -i https://pypi.anaconda.org/scipy-wheels-nightly/simple --upgrade numpy pandas
224+
225+
# Turn all warnings to errors, except ignore the distutils deprecations and the find_spec warning
226+
cat >> pytest.ini << EOF
227+
filterwarnings =
228+
error
229+
ignore:.*distutils:DeprecationWarning
230+
ignore:DynamicImporter.find_spec\(\) not found; falling back to find_module\(\):ImportWarning
231+
EOF
232+
216233
- name: Install Matplotlib
217234
run: |
218235
ccache -s
@@ -270,3 +287,18 @@ jobs:
270287
with:
271288
name: "${{ matrix.python-version }} ${{ matrix.os }} ${{ matrix.name-suffix }} result images"
272289
path: ./result_images
290+
291+
- name: Create issue on failure
292+
uses: imjohnbo/issue-bot@v3
293+
if: ${{ failure() && github.event_name == 'schedule' }}
294+
with:
295+
title: "[TST] Upcoming dependency test failures"
296+
body: |
297+
The weekly build with nightly wheels from numpy and pandas
298+
has failed. Check the logs for any updates that need to be
299+
made in matplotlib.
300+
301+
pinned: false
302+
close-previous: false
303+
env:
304+
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
@@ -3378,6 +3378,8 @@ def test_errorbar():
33783378
ax.errorbar(x, y, yerr=[yerr_lower, 2*yerr], xerr=xerr,
33793379
fmt='o', ecolor='g', capthick=2)
33803380
ax.set_title('Mixed sym., log y')
3381+
# Force limits due to floating point slop potentially expanding the range
3382+
ax.set_ylim(1e-2, 1e1)
33813383

33823384
fig.suptitle('Variable errorbars')
33833385

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)