Skip to content

Commit 83a655a

Browse files
author
Ubuntu
committed
Upgrating to python 3.13
1 parent f4eabae commit 83a655a

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

python-test-samples/kinesis-lambda-dynamodb/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
[![python: 3.9](https://img.shields.io/badge/Python-3.9-green)](https://img.shields.io/badge/Python-3.9-green)
2-
[![AWS: DynamoDB](https://img.shields.io/badge/AWS-DynamoDB-blueviolet)](https://img.shields.io/badge/AWS-DynamoDB-blueviolet)
1+
[![python: 3.13](https://img.shields.io/badge/Python-3.13-green)](https://img.shields.io/badge/Python-3.13-green)[![AWS: DynamoDB](https://img.shields.io/badge/AWS-DynamoDB-blueviolet)](https://img.shields.io/badge/AWS-DynamoDB-blueviolet)
32
[![AWS: Kinesis](https://img.shields.io/badge/AWS-Kinesis-orange)](https://img.shields.io/badge/AWS-Kinesis-orange)
43
[![test: unit](https://img.shields.io/badge/Test-Unit-blue)](https://img.shields.io/badge/Test-Unit-blue)
54
[![test: integration](https://img.shields.io/badge/Test-Integration-yellow)](https://img.shields.io/badge/Test-Integration-yellow)

python-test-samples/kinesis-lambda-dynamodb/template.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Resources:
6464
Properties:
6565
CodeUri: src/
6666
Handler: app.lambda_handler
67-
Runtime: python3.9
67+
Runtime: python3.13
6868
Architectures:
6969
- x86_64
7070
Tracing: Active

python-test-samples/kinesis-lambda-dynamodb/tests/unit/mock_test.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@
1313
import boto3
1414
from boto3 import Session
1515
from boto3.dynamodb.conditions import Key
16-
import moto
16+
from moto import mock_aws
1717

1818
# Mock the DynamoDB Service during the test
19-
@moto.mock_dynamodb
19+
@mock_aws # Only use this decorator, remove @moto.mock_dynamodb
2020
class TestKinesisLambdaWithDynamoDB(TestCase):
2121
"""
2222
Unit Test class for src/app.py
2323
"""
24+
2425
def setUp(self) -> None:
2526
"""
2627
Test Set up:
@@ -35,7 +36,7 @@ def setUp(self) -> None:
3536
os.environ["DYNAMODB_TABLE_NAME"] = self.test_ddb_table_name
3637
sam_template_table = self.read_sam_template()["Resources"]["DynamoDBTable"]
3738
sam_template_table_properties = sam_template_table["Properties"]
38-
self.mock_dynamodb = boto3.Session(region_name="us-east-1").resource("dynamodb")
39+
self.mock_dynamodb = boto3.Session.resource("dynamodb")
3940
self.mock_dynamodb_table = self.mock_dynamodb.create_table(
4041
TableName = self.test_ddb_table_name,
4142
KeySchema = sam_template_table_properties["KeySchema"],
@@ -47,7 +48,6 @@ def tearDown(self) -> None:
4748
"""
4849
For teardown, remove the environment variable
4950
"""
50-
5151
del os.environ['DYNAMODB_TABLE_NAME']
5252

5353
def read_sam_template(self, sam_template_fn : str = "template.yaml" ) -> dict:
@@ -64,7 +64,6 @@ def load_test_event(self, test_event_file_name: str) -> Dict[str, Any]:
6464
Add the test isolation postfix to the path parameter {id}
6565
"""
6666
try:
67-
6867
with open(f"tests/events/{test_event_file_name}.json","r") as file_name:
6968
event = json.load(file_name)
7069
return event

0 commit comments

Comments
 (0)