From 4cf54f4f837a3ba974f9fac9255dc0db227064bc Mon Sep 17 00:00:00 2001 From: Greg Lucas Date: Sun, 14 Nov 2021 09:01:30 -0700 Subject: [PATCH] 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. --- .github/workflows/tests.yml | 32 +++++++++++++++++++++++++++++ lib/matplotlib/tests/test_axes.py | 2 ++ lib/matplotlib/tests/test_colors.py | 7 ++++--- 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 13ae3c8d3322..e803b7835508 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,6 +8,9 @@ on: pull_request: branches-ignore: - v[0-9]+.[0-9]+.[0-9x]+-doc + schedule: + # 3:47 UTC on Saturdays + - cron: "47 3 * * 6" env: NO_AT_BRIDGE: 1 # Necessary for GTK3 interactive test. @@ -209,6 +212,20 @@ jobs: echo 'wxPython is available' || echo 'wxPython is not available' + - name: Install the nightly dependencies + # Only install the nightly dependencies during the scheduled event + if: ${{ github.event_name == 'schedule' && matrix.name-suffix != '(Minimum Versions)' }} + run: | + python -m pip install -i https://pypi.anaconda.org/scipy-wheels-nightly/simple --upgrade numpy pandas + + # Turn all warnings to errors, except ignore the distutils deprecations and the find_spec warning + cat >> pytest.ini << EOF + filterwarnings = + error + ignore:.*distutils:DeprecationWarning + ignore:DynamicImporter.find_spec\(\) not found; falling back to find_module\(\):ImportWarning + EOF + - name: Install Matplotlib run: | ccache -s @@ -266,3 +283,18 @@ jobs: with: name: "${{ matrix.python-version }} ${{ matrix.os }} ${{ matrix.name-suffix }} result images" path: ./result_images + + - name: Create issue on failure + uses: imjohnbo/issue-bot@v3 + if: ${{ failure() && github.event_name == 'schedule' }} + with: + title: "[TST] Upcoming dependency test failures" + body: | + The weekly build with nightly wheels from numpy and pandas + has failed. Check the logs for any updates that need to be + made in matplotlib. + + pinned: false + close-previous: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index 81b1b09ddd51..26579aaf8671 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -3438,6 +3438,8 @@ def test_errorbar(): ax.errorbar(x, y, yerr=[yerr_lower, 2*yerr], xerr=xerr, fmt='o', ecolor='g', capthick=2) ax.set_title('Mixed sym., log y') + # Force limits due to floating point slop potentially expanding the range + ax.set_ylim(1e-2, 1e1) fig.suptitle('Variable errorbars') diff --git a/lib/matplotlib/tests/test_colors.py b/lib/matplotlib/tests/test_colors.py index 0db62f82b64e..e72b9d7a8d28 100644 --- a/lib/matplotlib/tests/test_colors.py +++ b/lib/matplotlib/tests/test_colors.py @@ -568,14 +568,15 @@ def test_Normalize(): # Don't lose precision on longdoubles (float128 on Linux): # for array inputs... vals = np.array([1.2345678901, 9.8765432109], dtype=np.longdouble) - norm = mcolors.Normalize(vals.min(), vals.max()) - assert_array_equal(np.asarray(norm(vals)), [0, 1]) + norm = mcolors.Normalize(vals[0], vals[1]) + assert norm(vals).dtype == np.longdouble + assert_array_equal(norm(vals), [0, 1]) # and for scalar ones. eps = np.finfo(np.longdouble).resolution norm = plt.Normalize(1, 1 + 100 * eps) # This returns exactly 0.5 when longdouble is extended precision (80-bit), # but only a value close to it when it is quadruple precision (128-bit). - assert 0 < norm(1 + 50 * eps) < 1 + np.testing.assert_array_almost_equal_nulp(norm(1 + 50 * eps), 0.5) def test_FuncNorm():