Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark test_computationerror_ipython as flaky #107

Merged
merged 3 commits into from
Oct 29, 2023
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
24 changes: 16 additions & 8 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ jobs:
python:
# llvmlite (thus numba, thus sparse) usually lags the latest Python
# release. Only test SparseDataArray where possible.
# Earliest version supported by genno; matches xarray/setup.cfg
# Earliest version supported by genno = earliest Python that has not
# reached EOL
- {version: "3.8", extras: ",sparse"}
- {version: "3.9", extras: ",sparse"}
- {version: "3.10", extras: ",sparse"}
Expand All @@ -38,7 +39,7 @@ jobs:
# Compiling these on the job runner requires a more elaborate build
# environment, currently out of scope for genno. Exclude these versions
# from CI.
# - {version: "3.12.0-alpha.2", extras: ""} # Development version
# - {version: "3.13.0-rc.1", extras: ""} # Development version

fail-fast: false

Expand All @@ -61,14 +62,15 @@ jobs:
macos-skip-brew-update: true

- name: Install the Python package and dependencies
run: pip install --upgrade --upgrade-strategy=eager .[docs,tests${{ matrix.python.extras }}]
run: pip install --upgrade --upgrade-strategy=eager .[tests${{ matrix.python.extras }}]

- name: Run test suite using pytest
run: pytest genno --trace-config --color=yes --verbose --cov-report=xml --cov-report=term --numprocesses auto

- name: Test documentation build using Sphinx
if: startsWith(matrix.os, 'ubuntu')
run: make -C doc html
run: |
pytest genno \
--trace-config --color=yes --verbose \
--cov-report=xml --cov-report=term \
--numprocesses auto
shell: bash

- name: Upload test coverage to Codecov.io
uses: codecov/codecov-action@v3
Expand All @@ -81,4 +83,10 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4

- name: Force recreation of pre-commit virtual environment for mypy
if: github.event_name == 'schedule' # Comment this line to run on a PR
run: gh cache list -L 999 | cut -f2 | grep pre-commit | xargs -I{} gh cache delete "{}" || true
env: { GH_TOKEN: "${{ github.token }}" }

- uses: pre-commit/[email protected]
9 changes: 9 additions & 0 deletions genno/tests/core/test_exceptions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import os
import re

import pytest

from genno import ComputationError, Computer
from genno.testing import assert_logs
from genno.testing.jupyter import get_cell_output, run_notebook
Expand Down Expand Up @@ -48,6 +51,12 @@ def test_computationerror_format(caplog):
)


@pytest.mark.flaky(
reruns=5,
rerun_delay=2,
condition="GITHUB_ACTIONS" in os.environ,
reason="Flaky; fails occasionally on GitHub Actions runners",
)
def test_computationerror_ipython(test_data_path, tmp_path):
# NB this requires nbformat >= 5.0, because the output kind "evalue" was
# different pre-5.0
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ tests = [
"nbclient",
"pytest",
"pytest-cov",
"pytest-rerunfailures",
"pytest-xdist",
]
sparse = ["sparse >= 0.12"]
Expand Down
Loading