File tree Expand file tree Collapse file tree 6 files changed +40
-0
lines changed
Expand file tree Collapse file tree 6 files changed +40
-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+
3+ from aws_durable_execution_sdk_python .context import DurableContext
4+ from aws_durable_execution_sdk_python .execution import durable_handler
5+
6+
7+ @durable_handler
8+ def handler (_event : Any , _context : DurableContext ) -> str :
9+ """Simple hello world 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+ from aws_durable_execution_sdk_python .execution import InvocationStatus
4+
5+ from aws_durable_execution_sdk_python_testing .runner import (
6+ DurableFunctionTestResult ,
7+ DurableFunctionTestRunner ,
8+ )
9+ from src import hello_world
10+
11+
12+ class TestExamples :
13+ """Integration tests for examples."""
14+
15+ def test_hello_world (self ):
16+ """Test hello world example."""
17+ with DurableFunctionTestRunner (handler = hello_world .handler ) as runner :
18+ result : DurableFunctionTestResult = runner .run (input = "test" , timeout = 10 )
19+
20+ assert result .status is InvocationStatus .SUCCEEDED # noqa: S101
21+ assert result .result == '"Hello World!"' # noqa: S101
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