Skip to content

Commit

Permalink
annotate pytest failures on pull-request
Browse files Browse the repository at this point in the history
  • Loading branch information
bjlittle committed Jul 14, 2022
1 parent 2e63cdc commit 9ca8ac1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,12 @@ jobs:
echo "image.cmap : viridis" >> ${MPL_RC}
cat ${MPL_RC}
- if: ${{ matrix.os }} == "ubuntu-latest" and ${{ matrix.python-version }} == "3.10"
run: |
echo "FLAG_ANNOTATE=--annotate" >> ${GITHUB_ENV}
- name: "iris ${{ matrix.session }}"
env:
PY_VER: ${{ matrix.python-version }}
run: |
nox --session ${{ matrix.session }} -- --verbose
nox --session ${{ matrix.session }} -- --verbose ${FLAG_ANNOTATE}
8 changes: 7 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#: One specific python version for docs builds
_PY_VERSION_DOCSBUILD = _PY_VERSION_LATEST

#: Cirrus-CI environment variable hook.
#: Python environment variable hook.
PY_VER = os.environ.get("PY_VER", _PY_VERSIONS_ALL)

#: Default cartopy cache directory.
Expand Down Expand Up @@ -170,6 +170,12 @@ def prepare_venv(session: nox.sessions.Session) -> None:
"--explicit",
)

# Determine whether to annotate failed tests within CI with a GHA.
annotate = "-a" in session.posargs or "--annotate" in session.posargs

if annotate:
session.install("pytest-github-actions-annotate-failures")


@nox.session(python=PY_VER, venv_backend="conda")
def tests(session: nox.sessions.Session):
Expand Down

0 comments on commit 9ca8ac1

Please sign in to comment.