diff --git a/.github/workflows/build-ultraplot.yml b/.github/workflows/build-ultraplot.yml index cd88b89a..ab19ab15 100644 --- a/.github/workflows/build-ultraplot.yml +++ b/.github/workflows/build-ultraplot.yml @@ -15,7 +15,7 @@ env: jobs: build-ultraplot: - name: Test Python ${{ inputs.python-version }} with ${{ inputs.matplotlib-version }} + name: Test Python ${{ inputs.python-version }} with MPL ${{ inputs.matplotlib-version }} runs-on: ubuntu-latest timeout-minutes: 60 defaults: @@ -52,6 +52,7 @@ jobs: slug: Ultraplot/ultraplot compare-baseline: + name: Compare baseline Python ${{ inputs.python-version }} with MPL ${{ inputs.matplotlib-version }} runs-on: ubuntu-latest defaults: run: @@ -76,14 +77,23 @@ jobs: git fetch origin ${{ github.event.pull_request.base.sha }} git checkout ${{ github.event.pull_request.base.sha }} python -c "import ultraplot as plt; plt.config.Configurator()._save_yaml('ultraplot.yml')" - pytest -W ignore --mpl-generate-path=baseline --mpl-default-style="./ultraplot.yml" + pytest -W ignore \ + --mpl-generate-path=./baseline/ \ + --mpl-default-style="./ultraplot.yml"\ + ultraplot/tests git checkout ${{ github.sha }} # Return to PR branch - name: Image Comparison Ultraplot run: | mkdir -p results python -c "import ultraplot as plt; plt.config.Configurator()._save_yaml('ultraplot.yml')" - pytest -W ignore --mpl --mpl-baseline-path=baseline --mpl-generate-summary=html --mpl-results-path=./results/ --mpl-default-style="./ultraplot.yml" --store-failed-only ultraplot/tests + pytest -W ignore \ + --mpl \ + --mpl-baseline-path=./baseline/ \ + --mpl-results-path=./results/ \ + --mpl-generate-summary=html \ + --mpl-default-style="./ultraplot.yml" \ + ultraplot/tests # Return the html output of the comparison even if failed - name: Upload comparison failures diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9e9a3519..01d9c856 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -153,4 +153,3 @@ jobs: exit 1 fi fi - diff --git a/ultraplot/tests/conftest.py b/ultraplot/tests/conftest.py index db2482d9..f296ab9d 100644 --- a/ultraplot/tests/conftest.py +++ b/ultraplot/tests/conftest.py @@ -1,6 +1,7 @@ import os, shutil, pytest, re, numpy as np, ultraplot as uplt from pathlib import Path -import warnings, logging +import warnings, logging, gc +from matplotlib._pylab_helpers import Gcf logging.getLogger("matplotlib").setLevel(logging.ERROR) SEED = 51423 @@ -18,6 +19,9 @@ def rng(): def close_figures_after_test(): yield uplt.close("all") + assert uplt.pyplot.get_fignums() == [], f"Open figures {uplt.pyplot.get_fignums()}" + Gcf.destroy_all() + gc.collect() # Define command line option