Skip to content

Commit c213df8

Browse files
Rerun tests once on Athena service-side query failures
Overlapping CI runs share one AWS account, and Athena occasionally fails a query with an internal or S3-side error that is unrelated to the change under test (#804). Rerun a failed test once, but only when the error message is one of these Athena-side failures. Other failures still fail on the first attempt, and the library's execute() behavior is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 82e88f4 commit c213df8

3 files changed

Lines changed: 21 additions & 3 deletions

File tree

‎justfile‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
RUFF_VERSION := "0.14.14"
99
TOX_VERSION := "4.34.1"
10+
# Rerun a test once when Athena fails a query with a service-side error (#804).
11+
PYTEST_RERUN := "--reruns 1 --only-rerun 'Amazon Athena experienced an internal error' --only-rerun 'Invalid S3 request'"
1012

1113
# List available recipes
1214
default:
@@ -42,13 +44,13 @@ _test-help:
4244
@echo " sqla-async Run SQLAlchemy async dialect tests"
4345

4446
_test-pyathena: lint
45-
uv run pytest -n 8 --cov pyathena --cov-report html --cov-report term tests/pyathena/
47+
uv run pytest -n 8 {{PYTEST_RERUN}} --cov pyathena --cov-report html --cov-report term tests/pyathena/
4648

4749
_test-sqla:
48-
uv run pytest -n 8 --cov pyathena --cov-report html --cov-report term tests/sqlalchemy/
50+
uv run pytest -n 8 {{PYTEST_RERUN}} --cov pyathena --cov-report html --cov-report term tests/sqlalchemy/
4951

5052
_test-sqla-async:
51-
uv run pytest -n 8 --cov pyathena --cov-report html --cov-report term tests/sqlalchemy/ --dburi async
53+
uv run pytest -n 8 {{PYTEST_RERUN}} --cov pyathena --cov-report html --cov-report term tests/sqlalchemy/ --dburi async
5254

5355
# Run tests across multiple Python versions with tox
5456
tox:

‎pyproject.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ dev = [
8282
"pytest-asyncio",
8383
"pytest-xdist",
8484
"pytest-dependency",
85+
"pytest-rerunfailures",
8586
"sphinx",
8687
"sphinx-multiversion",
8788
"sphinxext-opengraph",

‎uv.lock‎

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)