Skip to content
Closed
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
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ jobs:
# Build and test the project
build-lint-test:
strategy:
fail-fast: true
# Let every matrix job finish so one flaky job does not hide the others.
fail-fast: false
matrix:
python: ["3.10", "3.14"]
os: [ubuntu-latest, macos-intel, macos-arm, windows-latest]
Expand Down
3 changes: 3 additions & 0 deletions bedrock_agentcore/strands_agent/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ dev = [
"poethepoet>=0.36.0",
"pytest>=7.1.2,<8",
"pytest-asyncio>=0.18.3,<0.19",
"pytest-timeout>=2.2,<3",
]

[build-system]
Expand All @@ -47,6 +48,8 @@ lint-types = "uv run --all-groups mypy --check-untyped-defs --namespace-packages
test = "uv run pytest"

[tool.pytest.ini_options]
# Fail a test that hangs, with a stack dump, instead of stalling the job.
timeout = 300
asyncio_mode = "auto"

[tool.ruff]
Expand Down
16 changes: 15 additions & 1 deletion bedrock_agentcore/strands_agent/uv.lock

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

3 changes: 3 additions & 0 deletions lambda_worker/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ dev = [
"poethepoet>=0.36.0",
"pytest>=7.1.2,<8",
"pytest-asyncio>=0.18.3,<0.19",
"pytest-timeout>=2.2,<3",
]

[build-system]
Expand Down Expand Up @@ -42,6 +43,8 @@ test = "uv run pytest"

[tool.pytest.ini_options]
asyncio_mode = "auto"
# Fail a test that hangs, with a stack dump, instead of stalling the job.
timeout = 300

[tool.ruff]
target-version = "py310"
14 changes: 14 additions & 0 deletions lambda_worker/uv.lock

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

3 changes: 3 additions & 0 deletions openai_agents/mcp_v2/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ dev = [
"mypy>=1.4.1,<2",
"poethepoet>=0.36.0",
"pytest>=9.0.3,<10",
"pytest-timeout>=2.2,<3",
]

[tool.poe.tasks]
Expand All @@ -35,5 +36,7 @@ target-version = "py310"
ignore_missing_imports = true

[tool.pytest.ini_options]
# Fail a test that hangs, with a stack dump, instead of stalling the job.
timeout = 300
pythonpath = ["."]
testpaths = ["tests"]
14 changes: 14 additions & 0 deletions openai_agents/mcp_v2/uv.lock

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

3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ dev = [
"mypy>=1.4.1,<2",
"pytest>=7.1.2,<8",
"pytest-asyncio>=0.18.3,<0.19",
"pytest-timeout>=2.2,<3",
"fakeredis>=2,<3",
"frozenlist>=1.4.0,<2",
"pyright>=1.1.394",
Expand Down Expand Up @@ -135,6 +136,8 @@ test = "uv run --all-groups --no-group cloud-export-to-parquet pytest"

[tool.pytest.ini_options]
asyncio_mode = "auto"
# Fail a test that hangs, with a stack dump, instead of stalling the job.
timeout = 300
log_cli = true
log_cli_level = "INFO"
log_cli_format = "%(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s)"
Expand Down
60 changes: 44 additions & 16 deletions tests/sentry/test_interceptor.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import json
import sys
import unittest.mock
import uuid
from collections import abc

import pytest
Expand Down Expand Up @@ -34,22 +36,26 @@ def transport() -> FakeSentryTransport:


@pytest.fixture(autouse=True)
def sentry_init(transport: FakeSentryTransport) -> None:
"""Initialize Sentry for testing."""
sentry_sdk.init(
transport=transport,
integrations=[
AsyncioIntegration(),
],
)
def sentry_init(transport: FakeSentryTransport) -> abc.Iterator[None]:
"""Give each test its own Sentry client and empty scopes, so nothing an
earlier test captured or left as a breadcrumb leaks into this one."""
for scope in (
sentry_sdk.get_global_scope(),
sentry_sdk.get_isolation_scope(),
sentry_sdk.get_current_scope(),
):
scope.clear()
sentry_sdk.init(transport=transport, integrations=[AsyncioIntegration()])
yield
sentry_sdk.get_client().close()


@pytest.fixture
async def worker(client: Client) -> abc.AsyncIterator[Worker]:
"""Fixture to provide a worker for testing."""
async with Worker(
client,
task_queue="sentry-task-queue",
task_queue=f"sentry-{uuid.uuid4()}",
workflows=[SentryExampleWorkflow],
activities=[broken_activity, working_activity],
interceptors=[SentryInterceptor()],
Expand All @@ -71,7 +77,7 @@ async def test_sentry_interceptor_reports_no_errors_when_workflow_succeeds(
await client.execute_workflow(
SentryExampleWorkflow.run,
SentryExampleWorkflowInput(option="working"),
id="sentry-workflow-id",
id=f"sentry-workflow-{uuid.uuid4()}",
task_queue=worker.task_queue,
)
except Exception:
Expand All @@ -85,12 +91,13 @@ async def test_sentry_interceptor_captures_errors(
client: Client, worker: Worker, transport: FakeSentryTransport
) -> None:
"""Test that errors are captured with correct Sentry metadata."""
workflow_id = f"sentry-workflow-{uuid.uuid4()}"
# WHEN
try:
await client.execute_workflow(
SentryExampleWorkflow.run,
SentryExampleWorkflowInput(option="broken"),
id="sentry-workflow-id",
id=workflow_id,
task_queue=worker.task_queue,
)
pytest.fail("Workflow should raise an exception")
Expand All @@ -99,7 +106,28 @@ async def test_sentry_interceptor_captures_errors(

# THEN
# there should be two events: one for the failed activity and one for the failed workflow
assert len(transport.events) == 2, "Two events should be captured"
assert len(transport.events) == 2, (
"Two events should be captured; got: "
+ json.dumps(
[
{
k: dict(e).get(k)
for k in (
"level",
"logger",
"message",
"logentry",
"exception",
"transaction",
"tags",
"extra",
)
}
for e in transport.events
],
default=str,
)
)

# Check the first event - should be the activity exception
# --------------------------------------------------------
Expand All @@ -114,10 +142,10 @@ async def test_sentry_interceptor_captures_errors(
"temporal.execution_type": "activity",
"module": "sentry.activity.broken_activity",
"temporal.workflow.type": "SentryExampleWorkflow",
"temporal.workflow.id": "sentry-workflow-id",
"temporal.workflow.id": workflow_id,
"temporal.activity.id": "1",
"temporal.activity.type": "broken_activity",
"temporal.activity.task_queue": "sentry-task-queue",
"temporal.activity.task_queue": worker.task_queue,
"temporal.workflow.namespace": "default",
"temporal.workflow.run_id": unittest.mock.ANY,
}
Expand Down Expand Up @@ -146,8 +174,8 @@ async def test_sentry_interceptor_captures_errors(
"temporal.execution_type": "workflow",
"module": "sentry.workflow.SentryExampleWorkflow.run",
"temporal.workflow.type": "SentryExampleWorkflow",
"temporal.workflow.id": "sentry-workflow-id",
"temporal.workflow.task_queue": "sentry-task-queue",
"temporal.workflow.id": workflow_id,
"temporal.workflow.task_queue": worker.task_queue,
"temporal.workflow.namespace": "default",
"temporal.workflow.run_id": unittest.mock.ANY,
}
Expand Down
16 changes: 15 additions & 1 deletion uv.lock

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

Loading