Skip to content
Merged
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
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,7 @@ jobs:
run: hatch run types:check
- name: Run tests + coverage
run: hatch run test:cov
- name: Run example tests
run: hatch run test:examples
- name: Build distribution
run: hatch build
3 changes: 3 additions & 0 deletions examples/src/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""AWS Durable Functions Python Examples."""

__version__ = "0.1.0"
10 changes: 10 additions & 0 deletions examples/src/hello_world.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from typing import Any

from aws_durable_execution_sdk_python.context import DurableContext
from aws_durable_execution_sdk_python.execution import durable_handler


@durable_handler
def handler(_event: Any, _context: DurableContext) -> str:
"""Simple hello world durable function."""
return "Hello World!"
1 change: 1 addition & 0 deletions examples/test/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Integration tests for AWS Durable Functions Python Examples."""
21 changes: 21 additions & 0 deletions examples/test/test_hello_world.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"""Integration tests for example durable functions."""

from aws_durable_execution_sdk_python.execution import InvocationStatus

from aws_durable_execution_sdk_python_testing.runner import (
DurableFunctionTestResult,
DurableFunctionTestRunner,
)
from src import hello_world


class TestExamples:
"""Integration tests for examples."""

def test_hello_world(self):
"""Test hello world example."""
with DurableFunctionTestRunner(handler=hello_world.handler) as runner:
result: DurableFunctionTestResult = runner.run(input="test", timeout=10)

assert result.status is InvocationStatus.SUCCEEDED # noqa: S101
assert result.result == '"Hello World!"' # noqa: S101
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,12 @@ dependencies = [
"coverage[toml]",
"pytest",
"pytest-cov",
"aws_durable_execution_sdk_python @ git+ssh://git@github.com/aws/aws-durable-execution-sdk-python.git"
]

[tool.hatch.envs.test.scripts]
test = "pytest tests/ -v"
examples = "pytest examples/test/ -v"
cov="pytest --cov-report=term-missing --cov-config=pyproject.toml --cov=src/aws_durable_execution_sdk_python_testing --cov=tests --cov-fail-under=99"

[tool.hatch.envs.types]
Expand Down