Skip to content

Commit

Permalink
Test docs during CI (mwaskom#2109)
Browse files Browse the repository at this point in the history
* Excecute gallery scripts and fail on errors

* Revert change to github ci workflow

* Test doc build with intentionally broken notebook

* Revert broken notebook

* Use MPLBACKEND environment variable

* Reorganize testing-related files

* Specify qt version for travis

* Don't test backend rcParam
  • Loading branch information
mwaskom committed May 31, 2020
1 parent a9dc80e commit a76477e
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ env:

jobs:

checks:
build-docs:
runs-on: ubuntu-latest
steps:

Expand All @@ -24,7 +24,7 @@ jobs:
- name: Install seaborn
run: |
python -m pip install --upgrade pip
pip install `cat testing/deps_latest.txt testing/utils.txt`
pip install `cat ci/deps_latest.txt ci/utils.txt`
pip install .
- name: Install doc tools
Expand Down
19 changes: 9 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ services:


env:
- PYTHON=3.6 DEPS=pinned BACKEND=agg DOCTESTS=true
- PYTHON=3.6 DEPS=latest BACKEND=agg DOCTESTS=true
- PYTHON=3.7 DEPS=latest BACKEND=agg DOCTESTS=true
- PYTHON=3.8 DEPS=latest BACKEND=agg DOCTESTS=true
- PYTHON=3.8 DEPS=latest BACKEND=qtagg DOCTESTS=true
- PYTHON=3.8 DEPS=minimal BACKEND=agg DOCTESTS=false
- PYTHON=3.6 DEPS=pinned MPLBACKEND=agg DOCTESTS=true
- PYTHON=3.6 DEPS=latest MPLBACKEND=agg DOCTESTS=true
- PYTHON=3.7 DEPS=latest MPLBACKEND=agg DOCTESTS=true
- PYTHON=3.8 DEPS=latest MPLBACKEND=agg DOCTESTS=true
- PYTHON=3.8 DEPS=latest MPLBACKEND=qt5agg DOCTESTS=true
- PYTHON=3.8 DEPS=minimal MPLBACKEND=agg DOCTESTS=false


before_install:
- sudo apt-get update -yq
- sudo sh testing/getmsfonts.sh
- sudo sh ci/getmsfonts.sh
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
Expand All @@ -32,14 +32,13 @@ before_install:
install:
- conda create -n testenv pip python=$PYTHON
- source activate testenv
- cat testing/deps_${DEPS}.txt testing/utils.txt > deps.txt
- cat ci/deps_${DEPS}.txt ci/utils.txt > deps.txt
- conda install --file deps.txt
- pip install .


before_script:
- cp testing/matplotlibrc_${BACKEND} matplotlibrc
- if [ $BACKEND == "qtagg" ]; then
- if [ $MPLBACKEND == "qtagg" ]; then
export DISPLAY=:99.0;
sh -e /etc/init.d/xvfb start;
sleep 3;
Expand Down
14 changes: 14 additions & 0 deletions ci/check_gallery.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""Execute the scripts that comprise the example gallery in the online docs."""
from glob import glob
import matplotlib.pyplot as plt

if __name__ == "__main__":

fnames = sorted(glob("examples/*.py"))

for fname in fnames:

print(f"- {fname}")
with open(fname) as fid:
exec(fid.read())
plt.close("all")
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion doc/tutorial/distributions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.2"
"version": "3.7.4"
}
},
"nbformat": 4,
Expand Down
4 changes: 4 additions & 0 deletions seaborn/tests/test_rcmod.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ def flatten_list(self, orig_list):
def assert_rc_params(self, params):

for k, v in params.items():
# Various subtle issues in matplotlib lead to unexpected
# values for the backend rcParam, which isn't relevant here
if k == "backend":
continue
if isinstance(v, np.ndarray):
npt.assert_array_equal(mpl.rcParams[k], v)
else:
Expand Down
1 change: 0 additions & 1 deletion testing/matplotlibrc_agg

This file was deleted.

1 change: 0 additions & 1 deletion testing/matplotlibrc_qtagg

This file was deleted.

0 comments on commit a76477e

Please sign in to comment.