File tree Expand file tree Collapse file tree 6 files changed +43
-0
lines changed
Expand file tree Collapse file tree 6 files changed +43
-0
lines changed Original file line number Diff line number Diff line change 3838 run : hatch run types:check
3939 - name : Run tests + coverage
4040 run : hatch run test:cov
41+ - name : Run example tests
42+ run : hatch run test:examples
4143 - name : Build distribution
4244 run : hatch build
Original file line number Diff line number Diff line change 1+ """AWS Durable Functions Python Examples."""
2+
3+ __version__ = "0.1.0"
Original file line number Diff line number Diff line change 1+ from typing import Any
2+ from aws_durable_execution_sdk_python .context import DurableContext
3+ from aws_durable_execution_sdk_python .execution import durable_handler
4+
5+
6+ @durable_handler
7+ def handler (event : Any , context : DurableContext ) -> str :
8+ """Simple hello world durable function."""
9+ print ("Hello world from a durable function!" )
10+ return "Hello World!"
Original file line number Diff line number Diff line change 1+ """Integration tests for AWS Durable Functions Python Examples."""
Original file line number Diff line number Diff line change 1+ """Integration tests for example durable functions."""
2+
3+ import pytest
4+ from aws_durable_execution_sdk_python .execution import InvocationStatus
5+ from aws_durable_execution_sdk_python_testing .runner import (
6+ DurableFunctionTestResult ,
7+ DurableFunctionTestRunner ,
8+ )
9+
10+ from src import hello_world
11+
12+
13+ class TestExamples :
14+ """Integration tests for examples."""
15+
16+ def test_hello_world (self ):
17+ """Test hello world example."""
18+ with DurableFunctionTestRunner (handler = hello_world .handler ) as runner :
19+ result : DurableFunctionTestResult = runner .run (
20+ input = "test" , timeout = 10
21+ )
22+
23+ assert result .status is InvocationStatus .SUCCEEDED
24+ assert result .result == '"Hello World!"'
Original file line number Diff line number Diff line change @@ -53,9 +53,12 @@ dependencies = [
5353 " coverage[toml]" ,
5454 " pytest" ,
5555 " pytest-cov" ,
56+ " aws_durable_execution_sdk_python @ git+ssh://git@github.com/aws/aws-durable-execution-sdk-python.git"
5657]
5758
5859[tool .hatch .envs .test .scripts ]
60+ test = " pytest tests/ -v"
61+ examples = " pytest examples/test/ -v"
5962cov =" pytest --cov-report=term-missing --cov-config=pyproject.toml --cov=src/aws_durable_execution_sdk_python_testing --cov=tests --cov-fail-under=99"
6063
6164[tool .hatch .envs .types ]
You can’t perform that action at this time.
0 commit comments