Skip to content

Commit c78c808

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

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

python-test-samples/lambda-mock/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ clean: ##=> Deletes current build environment and latest build
99
rm -rf ./.aws-sam/ ./venv/
1010

1111
checkOSDependencies:
12-
python3 --version || grep "3.9" || (echo "Error: Requires Python 3.9" && exit 1)
12+
python3 --version | grep "3.13" || (echo "Error: Requires Python 3.13" && exit 1)
1313

1414
all: clean build
1515

python-test-samples/lambda-mock/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![python: 3.9](https://img.shields.io/badge/Python-3.9-green)](https://img.shields.io/badge/Python-3.9-green)
1+
[![python: 3.13](https://img.shields.io/badge/Python-3.13-green)](https://img.shields.io/badge/Python-3.13-green)
22
[![AWS: DynamoDB](https://img.shields.io/badge/AWS-DynamoDB-blueviolet)](https://img.shields.io/badge/AWS-DynamoDB-blueviolet)
33
[![AWS: S#](https://img.shields.io/badge/AWS-S3-green)](https://img.shields.io/badge/AWS-AWS-S3-green)
44
[![test: unit](https://img.shields.io/badge/Test-Unit-blue)](https://img.shields.io/badge/Test-Unit-blue)
@@ -70,14 +70,14 @@ This pattern can be used with a variety of infrastructure as code systems includ
7070

7171
The code in this project is simplified - we’ve opted for concise snippets over fully completed or PEP8 compliant production code.
7272

73-
[Top](#contents)
73+
[Top](#contents)x
7474

7575
---
7676
## Prerequisites
7777

7878
* [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)
7979
* [AWS Serverless Application Model (SAM) CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html)
80-
* [Python 3.9](https://www.python.org/downloads/)
80+
* [Python 3.13](https://www.python.org/downloads/)
8181
* [Make build utility](https://www.gnu.org/software/make/)
8282

8383
[Top](#contents)
@@ -100,6 +100,7 @@ The project Makefile contains helper commands for working with the project:
100100

101101
## Running the project
102102

103+
* Setting default region: export AWS_DEFAULT_REGION=us-east-1
103104
* First, create the Python Virtual Environment by using the ```make install``` command.
104105
* Run the unit tests with the ```make test``` command.
105106
* To (optionally) deploy the project, use the ```make deploy.g``` command.

python-test-samples/lambda-mock/template.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Resources:
5656
Properties:
5757
CodeUri: ./src/sample_lambda/
5858
Handler: app.lambda_handler
59-
Runtime: python3.9
59+
Runtime: python3.13
6060
MemorySize: 256
6161
Architectures:
6262
- arm64

python-test-samples/lambda-mock/tests/unit/src/test_sample_lambda.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from unittest import TestCase
1212
from unittest.mock import MagicMock, patch
1313
from boto3 import resource, client
14-
import moto
14+
from moto import mock_aws # Changed from import moto
1515
from aws_lambda_powertools.utilities.validation import validate
1616

1717
# [0] Import the Globals, Classes, Schemas, and Functions from the Lambda Handler
@@ -21,8 +21,7 @@
2121
from src.sample_lambda.schemas import INPUT_SCHEMA # pylint: disable=wrong-import-position
2222

2323
# [1] Mock all AWS Services in use
24-
@moto.mock_dynamodb
25-
@moto.mock_s3
24+
@mock_aws # Changed from @moto.mock_dynamodb @moto.mock_s3
2625
class TestSampleLambda(TestCase):
2726
"""
2827
Test class for the application sample AWS Lambda Function
@@ -198,4 +197,4 @@ def tearDown(self) -> None:
198197
dynamodb_resource = client("dynamodb", region_name="us-east-1")
199198
dynamodb_resource.delete_table(TableName = self.test_ddb_table_name )
200199

201-
# End of unit test code
200+
# End of unit test code

0 commit comments

Comments
 (0)