Skip to content

Commit

Permalink
ci: use pytest-retry for flaky test instead of retrying the entire su…
Browse files Browse the repository at this point in the history
…ite in ci
  • Loading branch information
ErikBjare committed Aug 14, 2024
1 parent b736a4b commit 580cc36
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ jobs:
if: contains(matrix.extras, 'browser') || contains(matrix.extras, 'all')
run: poetry run playwright install chromium

# OpenAI sometimes randomly aborts connections, so we retry once
# old comment: OpenAI sometimes randomly aborts connections
- name: Run tests
uses: nick-fields/retry@v2
env:
TERM: xterm
MODEL: ${{ matrix.provider }}
with:
timeout_minutes: 5
max_attempts: 2
max_attempts: 1 # favor pytest retries (mark with flaky)
retry_wait_seconds: 10
command: make test SLOW=true

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ test:
--cov=gptme --cov-report=xml --cov-report=term-missing --cov-report=html --junitxml=junit.xml \
-n 8 \
$(if $(EVAL), , -m "not eval") \
$(if $(SLOW), --timeout 60, --timeout 5 -m "not slow and not eval") \
$(if $(SLOW), --timeout 60 --retries 2 --retry-delay 5, --timeout 5 -m "not slow and not eval") \
$(if $(PROFILE), --profile-svg)

eval:
Expand Down
19 changes: 18 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ myst-parser = "^2.0.0"
pyupgrade = "^3.15.0"
greenlet = "*" # dependency of playwright, but needed for coverage
types-tabulate = "^0.9.0.20240106"
pytest-retry = "^1.6.3"

[tool.poetry.extras]
server = ["llama-cpp-python", "flask"]
Expand Down
1 change: 1 addition & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ def test_terminal(args: list[str], runner: CliRunner):

# TODO: move elsewhere
@pytest.mark.slow
@pytest.mark.flaky(retries=2, delay=5)
def test_subagent(args: list[str], runner: CliRunner):
# f14: 377
# f15: 610
Expand Down

0 comments on commit 580cc36

Please sign in to comment.