Skip to content
Open
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
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ dev = [
"pytest-asyncio<2.0.0",
"pytest-cov<8.0.0",
"pytest-httpserver<2.0.0",
"pytest-rerunfailures<17.0.0",
"pytest-timeout<3.0.0",
"pytest-xdist<4.0.0",
"pytest<9.0.0",
Expand Down
10 changes: 10 additions & 0 deletions tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
from collections.abc import Callable
from pathlib import Path

# Rerun all integration tests up to 3 times on failure, as the platform can be unstable.
_INTEGRATION_TEST_RERUNS = 3

_TOKEN_ENV_VAR = 'APIFY_TEST_USER_API_TOKEN'
_API_URL_ENV_VAR = 'APIFY_INTEGRATION_TESTS_API_URL'

Expand Down Expand Up @@ -89,3 +92,10 @@ def _isolate_test_environment(prepare_test_env: Callable[[], None]) -> None:
prepare_test_env: Fixture to prepare the environment before each test.
"""
prepare_test_env()


def pytest_collection_modifyitems(items: list[pytest.Item]) -> None:
"""Add flaky marker with reruns to all integration tests."""
flaky_marker = pytest.mark.flaky(reruns=_INTEGRATION_TEST_RERUNS)
for item in items:
item.add_marker(flaky_marker)
15 changes: 15 additions & 0 deletions uv.lock

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