Skip to content

Commit

Permalink
TST: Fix flaky test and don't fail fast (#20)
Browse files Browse the repository at this point in the history
Add `fail-fast` such that all `python` versions will finish
before exiting.

Add `pytest-rerunfailures` for the flaky test.

Fixes: #19
Reviewed-by: @ntessore
  • Loading branch information
paddyroddy authored Sep 8, 2023
1 parent 6231aa7 commit 146326e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,18 @@ jobs:
name: Tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: "pyproject.toml"
- run: pip install -c .github/test-constraints.txt '.[test]'
- run: pytest tests
- run: pytest
build:
name: Build
runs-on: ubuntu-latest
Expand Down
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ optional-dependencies = {docs = [
"sphinxcontrib-katex",
], test = [
"pytest",
"pytest-rerunfailures",
]}
readme = "README.md"
requires-python = ">=3.9"
Expand All @@ -55,6 +56,12 @@ force-exclude = """
build.hooks.vcs.version-file = "heracles/_version.py"
version.source = "vcs"

[tool.pytest.ini_options]
addopts = "--color=yes -v"
testpaths = [
"tests",
]

[tool.ruff]
extend-exclude = [
"_kmeans_radec.py",
Expand Down
4 changes: 4 additions & 0 deletions tests/test_kmeans_radec.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import pytest


@pytest.mark.flaky(reruns=2)
def test_kmeans_sample():
import numpy as np

Expand Down

0 comments on commit 146326e

Please sign in to comment.