Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions .github/workflows/build-ultraplot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,3 @@ jobs:
exit 1
fi
fi

6 changes: 5 additions & 1 deletion ultraplot/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down