Skip to content

Commit caa806e

Browse files
Merge branch 'develop' into feat/validation-json-schema-refs
2 parents 189714e + d1bedfd commit caa806e

17 files changed

+506
-327
lines changed

.github/workflows/quality_check.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ jobs:
6868
run: make mypy
6969
- name: Test with pytest
7070
run: make test
71+
- name: Test dependencies with Nox
72+
run: make test-dependencies
7173
- name: Security baseline
7274
run: make security-baseline
7375
- name: Complexity baseline

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,12 @@ jobs:
237237

238238
- name: Upload to PyPi prod
239239
if: ${{ !inputs.skip_pypi }}
240-
uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450 # v1.8.14
240+
uses: pypa/gh-action-pypi-publish@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0 # v1.9.0
241241

242242
# PyPi test maintenance affected us numerous times, leaving for history purposes
243243
# - name: Upload to PyPi test
244244
# if: ${{ !inputs.skip_pypi }}
245-
# uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450 # v1.8.14
245+
# uses: pypa/gh-action-pypi-publish@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0 # v1.9.0
246246
# with:
247247
# repository-url: https://test.pypi.org/legacy/
248248

.github/workflows/secure_workflows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- name: Checkout code
3333
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
3434
- name: Ensure 3rd party workflows have SHA pinned
35-
uses: zgosalvez/github-actions-ensure-sha-pinned-actions@76d1d8e0b075d7190b5d59b86da91c7bdbcc99b2 # v3.0.7
35+
uses: zgosalvez/github-actions-ensure-sha-pinned-actions@74606c30450304eee8660aae751818321754feb1 # v3.0.9
3636
with:
3737
allowlist: |
3838
slsa-framework/slsa-github-generator

CHANGELOG.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,32 @@
88

99
* **event_sources:** change partition and offset field types in KafkaEventRecord ([#4515](https://github.com/aws-powertools/powertools-lambda-python/issues/4515))
1010

11+
## Documentation
12+
13+
* **i-made-this:** add new article about best practices for accelerating serverless development ([#4518](https://github.com/aws-powertools/powertools-lambda-python/issues/4518))
14+
1115
## Maintenance
1216

13-
* **deps:** bump redis from 5.0.5 to 5.0.6 ([#4527](https://github.com/aws-powertools/powertools-lambda-python/issues/4527))
1417
* **deps:** bump codecov/codecov-action from 4.4.1 to 4.5.0 ([#4514](https://github.com/aws-powertools/powertools-lambda-python/issues/4514))
15-
* **deps-dev:** bump cdklabs-generative-ai-cdk-constructs from 0.1.182 to 0.1.184 ([#4529](https://github.com/aws-powertools/powertools-lambda-python/issues/4529))
18+
* **deps:** bump redis from 5.0.5 to 5.0.6 ([#4527](https://github.com/aws-powertools/powertools-lambda-python/issues/4527))
19+
* **deps:** bump the layer-balancer group in /layer/scripts/layer-balancer with 3 updates ([#4546](https://github.com/aws-powertools/powertools-lambda-python/issues/4546))
20+
* **deps:** bump fastjsonschema from 2.19.1 to 2.20.0 ([#4543](https://github.com/aws-powertools/powertools-lambda-python/issues/4543))
21+
* **deps:** bump squidfunk/mkdocs-material from `96abcbb` to `257eca8` in /docs ([#4540](https://github.com/aws-powertools/powertools-lambda-python/issues/4540))
22+
* **deps:** bump zgosalvez/github-actions-ensure-sha-pinned-actions from 3.0.7 to 3.0.9 ([#4539](https://github.com/aws-powertools/powertools-lambda-python/issues/4539))
23+
* **deps:** bump pypa/gh-action-pypi-publish from 1.8.14 to 1.9.0 ([#4538](https://github.com/aws-powertools/powertools-lambda-python/issues/4538))
24+
* **deps-dev:** bump ruff from 0.4.8 to 0.4.9 ([#4528](https://github.com/aws-powertools/powertools-lambda-python/issues/4528))
1625
* **deps-dev:** bump aws-cdk-lib from 2.145.0 to 2.146.0 ([#4526](https://github.com/aws-powertools/powertools-lambda-python/issues/4526))
26+
* **deps-dev:** bump mypy-boto3-secretsmanager from 1.34.125 to 1.34.128 in the boto-typing group ([#4541](https://github.com/aws-powertools/powertools-lambda-python/issues/4541))
27+
* **deps-dev:** bump aws-cdk from 2.145.0 to 2.146.0 ([#4525](https://github.com/aws-powertools/powertools-lambda-python/issues/4525))
28+
* **deps-dev:** bump cdklabs-generative-ai-cdk-constructs from 0.1.182 to 0.1.184 ([#4529](https://github.com/aws-powertools/powertools-lambda-python/issues/4529))
29+
* **deps-dev:** bump bandit from 1.7.8 to 1.7.9 ([#4511](https://github.com/aws-powertools/powertools-lambda-python/issues/4511))
1730
* **deps-dev:** bump cfn-lint from 0.87.6 to 0.87.7 ([#4513](https://github.com/aws-powertools/powertools-lambda-python/issues/4513))
1831
* **deps-dev:** bump filelock from 3.14.0 to 3.15.1 ([#4512](https://github.com/aws-powertools/powertools-lambda-python/issues/4512))
1932
* **deps-dev:** bump cdklabs-generative-ai-cdk-constructs from 0.1.179 to 0.1.182 ([#4510](https://github.com/aws-powertools/powertools-lambda-python/issues/4510))
20-
* **deps-dev:** bump aws-cdk from 2.145.0 to 2.146.0 ([#4525](https://github.com/aws-powertools/powertools-lambda-python/issues/4525))
33+
* **deps-dev:** bump urllib3 from 1.26.18 to 1.26.19 in /layer ([#4547](https://github.com/aws-powertools/powertools-lambda-python/issues/4547))
2134
* **deps-dev:** bump mypy-boto3-secretsmanager from 1.34.109 to 1.34.125 in the boto-typing group ([#4509](https://github.com/aws-powertools/powertools-lambda-python/issues/4509))
22-
* **deps-dev:** bump ruff from 0.4.8 to 0.4.9 ([#4528](https://github.com/aws-powertools/powertools-lambda-python/issues/4528))
23-
* **deps-dev:** bump bandit from 1.7.8 to 1.7.9 ([#4511](https://github.com/aws-powertools/powertools-lambda-python/issues/4511))
35+
* **deps-dev:** bump aws-cdk-aws-lambda-python-alpha from 2.145.0a0 to 2.146.0a0 ([#4542](https://github.com/aws-powertools/powertools-lambda-python/issues/4542))
36+
* **governance:** fix errors when creating Gitpod environment ([#4532](https://github.com/aws-powertools/powertools-lambda-python/issues/4532))
2437

2538

2639
<a name="v2.39.1"></a>

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ timeline
6767
Pre-Pull Request <br> (make pr) : Code linting
6868
: Docs linting
6969
: Static typing analysis
70-
: Tests (unit|functional|perf)
70+
: Tests (unit|functional|perf|dependencies)
7171
: Security baseline
7272
: Complexity baseline
7373
: +pre-commit checks

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ test:
3232
poetry run pytest -m "not perf" --ignore tests/e2e --cov=aws_lambda_powertools --cov-report=xml
3333
poetry run pytest --cache-clear tests/performance
3434

35+
test-dependencies:
36+
poetry run nox --error-on-external-run --reuse-venv=yes --non-interactive
37+
3538
test-pydanticv2:
3639
poetry run pytest -m "not perf" --ignore tests/e2e
3740

@@ -47,7 +50,7 @@ coverage-html:
4750
pre-commit:
4851
pre-commit run --show-diff-on-failure
4952

50-
pr: lint lint-docs mypy pre-commit test security-baseline complexity-baseline
53+
pr: lint lint-docs mypy pre-commit test test-dependencies security-baseline complexity-baseline
5154

5255
build: pr
5356
poetry build

docs/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# v9.1.18
2-
FROM squidfunk/mkdocs-material@sha256:96abcbb1bb6d4d79a6a142fe88150b3862b2b297fe45e6656b154d978b1787eb
2+
FROM squidfunk/mkdocs-material@sha256:257eca88da7f42242cd05e8cebf6d10ebd079edc207b089ad3f4f1ad107b0348
33
# pip-compile --generate-hashes --output-file=requirements.txt requirements.in
44
COPY requirements.txt /tmp/
55
RUN pip install --require-hashes -r /tmp/requirements.txt

layer/poetry.lock

Lines changed: 5 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

layer/scripts/layer-balancer/go.mod

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,25 @@ module layerbalancer
33
go 1.18
44

55
require (
6-
github.com/aws/aws-sdk-go-v2 v1.27.2
7-
github.com/aws/aws-sdk-go-v2/config v1.27.18
8-
github.com/aws/aws-sdk-go-v2/service/lambda v1.54.6
6+
github.com/aws/aws-sdk-go-v2 v1.29.0
7+
github.com/aws/aws-sdk-go-v2/config v1.27.20
8+
github.com/aws/aws-sdk-go-v2/service/lambda v1.55.0
99
golang.org/x/exp v0.0.0-20230321023759-10a507213a29
1010
golang.org/x/sync v0.7.0
1111
)
1212

1313
require (
1414
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.2 // indirect
15-
github.com/aws/aws-sdk-go-v2/credentials v1.17.18 // indirect
16-
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.5 // indirect
17-
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.9 // indirect
18-
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.9 // indirect
15+
github.com/aws/aws-sdk-go-v2/credentials v1.17.20 // indirect
16+
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.7 // indirect
17+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.11 // indirect
18+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.11 // indirect
1919
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect
2020
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2 // indirect
21-
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.11 // indirect
22-
github.com/aws/aws-sdk-go-v2/service/sso v1.20.11 // indirect
23-
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.24.5 // indirect
24-
github.com/aws/aws-sdk-go-v2/service/sts v1.28.12 // indirect
21+
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.13 // indirect
22+
github.com/aws/aws-sdk-go-v2/service/sso v1.21.0 // indirect
23+
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.25.0 // indirect
24+
github.com/aws/aws-sdk-go-v2/service/sts v1.29.0 // indirect
2525
github.com/aws/smithy-go v1.20.2 // indirect
2626
github.com/jmespath/go-jmespath v0.4.0 // indirect
2727
)

layer/scripts/layer-balancer/go.sum

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
1-
github.com/aws/aws-sdk-go-v2 v1.27.2 h1:pLsTXqX93rimAOZG2FIYraDQstZaaGVVN4tNw65v0h8=
2-
github.com/aws/aws-sdk-go-v2 v1.27.2/go.mod h1:ffIFB97e2yNsv4aTSGkqtHnppsIJzw7G7BReUZ3jCXM=
1+
github.com/aws/aws-sdk-go-v2 v1.29.0 h1:uMlEecEwgp2gs6CsM6ugquNHr6mg0LHylPBR8u5Ojac=
2+
github.com/aws/aws-sdk-go-v2 v1.29.0/go.mod h1:ffIFB97e2yNsv4aTSGkqtHnppsIJzw7G7BReUZ3jCXM=
33
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.2 h1:x6xsQXGSmW6frevwDA+vi/wqhp1ct18mVXYN08/93to=
44
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.2/go.mod h1:lPprDr1e6cJdyYeGXnRaJoP4Md+cDBvi2eOj00BlGmg=
5-
github.com/aws/aws-sdk-go-v2/config v1.27.18 h1:wFvAnwOKKe7QAyIxziwSKjmer9JBMH1vzIL6W+fYuKk=
6-
github.com/aws/aws-sdk-go-v2/config v1.27.18/go.mod h1:0xz6cgdX55+kmppvPm2IaKzIXOheGJhAufacPJaXZ7c=
7-
github.com/aws/aws-sdk-go-v2/credentials v1.17.18 h1:D/ALDWqK4JdY3OFgA2thcPO1c9aYTT5STS/CvnkqY1c=
8-
github.com/aws/aws-sdk-go-v2/credentials v1.17.18/go.mod h1:JuitCWq+F5QGUrmMPsk945rop6bB57jdscu+Glozdnc=
9-
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.5 h1:dDgptDO9dxeFkXy+tEgVkzSClHZje/6JkPW5aZyEvrQ=
10-
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.5/go.mod h1:gjvE2KBUgUQhcv89jqxrIxH9GaKs1JbZzWejj/DaHGA=
11-
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.9 h1:cy8ahBJuhtM8GTTSyOkfy6WVPV1IE+SS5/wfXUYuulw=
12-
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.9/go.mod h1:CZBXGLaJnEZI6EVNcPd7a6B5IC5cA/GkRWtu9fp3S6Y=
13-
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.9 h1:A4SYk07ef04+vxZToz9LWvAXl9LW0NClpPpMsi31cz0=
14-
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.9/go.mod h1:5jJcHuwDagxN+ErjQ3PU3ocf6Ylc/p9x+BLO/+X4iXw=
5+
github.com/aws/aws-sdk-go-v2/config v1.27.20 h1:oQSn/KNUMV54X0FBEDQQ2ymNfcKyMT81ar8gyvMzzqs=
6+
github.com/aws/aws-sdk-go-v2/config v1.27.20/go.mod h1:IbEMotJrWc3Bh7++HXZDlviHZP7kHrkHU3PNl9e17po=
7+
github.com/aws/aws-sdk-go-v2/credentials v1.17.20 h1:VYTCplAeOeBv5InTtrmF61OIwD4aHKryg3KZ6hf7dsI=
8+
github.com/aws/aws-sdk-go-v2/credentials v1.17.20/go.mod h1:ktubcFYvbN8++72jVM9IJoQH6Q2TP+Z7r2VbV1AaESU=
9+
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.7 h1:54QUEXjkE1SlxHmRA3gBXA52j/ZSAgdOfAFGv1NsPCY=
10+
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.7/go.mod h1:bQRjJsdSMzmo/qbtGeBtPbIMp1IgQ+9R9jYJLm12uJA=
11+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.11 h1:ltkhl3I9ddcRR3Dsy+7bOFFq546O8OYsfNEXVIyuOSE=
12+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.11/go.mod h1:H4D8JoCFNJwnT7U5U8iwgG24n71Fx2I/ZP/18eYFr9g=
13+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.11 h1:+BgX2AY7yV4ggSwa80z/yZIJX+e0jnNxjMLVyfpSXM0=
14+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.11/go.mod h1:DlBATBSDCz30BCdRFldmyLsAzJwi2pdQ+YSdJTHhTUI=
1515
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 h1:hT8rVHwugYE2lEfdFE0QWVo81lF7jMrYJVDWI+f+VxU=
1616
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0/go.mod h1:8tu/lYfQfFe6IGnaOdrpVgEL2IrrDOf6/m9RQum4NkY=
1717
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2 h1:Ji0DY1xUsUr3I8cHps0G+XM3WWU16lP6yG8qu1GAZAs=
1818
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2/go.mod h1:5CsjAbs3NlGQyZNFACh+zztPDI7fU6eW9QsxjfnuBKg=
19-
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.11 h1:o4T+fKxA3gTMcluBNZZXE9DNaMkJuUL1O3mffCUjoJo=
20-
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.11/go.mod h1:84oZdJ+VjuJKs9v1UTC9NaodRZRseOXCTgku+vQJWR8=
21-
github.com/aws/aws-sdk-go-v2/service/lambda v1.54.6 h1:UMu5aeSubjM9geSuPCGOgBAZa0JvsXxJBFXmKgUuisM=
22-
github.com/aws/aws-sdk-go-v2/service/lambda v1.54.6/go.mod h1:fWbFM4/v+IgUW+p4TooAXuhmiQyC5qxMV5gUqxDII2g=
23-
github.com/aws/aws-sdk-go-v2/service/sso v1.20.11 h1:gEYM2GSpr4YNWc6hCd5nod4+d4kd9vWIAWrmGuLdlMw=
24-
github.com/aws/aws-sdk-go-v2/service/sso v1.20.11/go.mod h1:gVvwPdPNYehHSP9Rs7q27U1EU+3Or2ZpXvzAYJNh63w=
25-
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.24.5 h1:iXjh3uaH3vsVcnyZX7MqCoCfcyxIrVE9iOQruRaWPrQ=
26-
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.24.5/go.mod h1:5ZXesEuy/QcO0WUnt+4sDkxhdXRHTu2yG0uCSH8B6os=
27-
github.com/aws/aws-sdk-go-v2/service/sts v1.28.12 h1:M/1u4HBpwLuMtjlxuI2y6HoVLzF5e2mfxHCg7ZVMYmk=
28-
github.com/aws/aws-sdk-go-v2/service/sts v1.28.12/go.mod h1:kcfd+eTdEi/40FIbLq4Hif3XMXnl5b/+t/KTfLt9xIk=
19+
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.13 h1:3A8vxp65nZy6aMlSCBvpIyxIbAN0DOSxaPDZuzasxuU=
20+
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.13/go.mod h1:IxJ/pMQ/Y+MDFGo6pQRyqzKKwtGMHb5IWp5PXSQr8dM=
21+
github.com/aws/aws-sdk-go-v2/service/lambda v1.55.0 h1:vrwMgAOU8ZXrWs0QZOOAFRdWFNxoL2DdH4doD0BkmU4=
22+
github.com/aws/aws-sdk-go-v2/service/lambda v1.55.0/go.mod h1:ZVT/r5NG5Fxjaw7rgDmOYVu0y2KELlQCcda/f+yypUQ=
23+
github.com/aws/aws-sdk-go-v2/service/sso v1.21.0 h1:P0zUA+5liaoNILI/btBBQHC09PFPyRJr+w+Xt9KHKck=
24+
github.com/aws/aws-sdk-go-v2/service/sso v1.21.0/go.mod h1:0bmRzdsq9/iNyP02H4UV0ZRjFx6qQBqRvfCJ4trFgjE=
25+
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.25.0 h1:jPV8U9r3msO9ECm9geW8PGjU/rz8vfPTPmIBbA83W3M=
26+
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.25.0/go.mod h1:B3G77bQDCmhp0RV0P/J9Kd4/qsymdWVhzTe3btAtywE=
27+
github.com/aws/aws-sdk-go-v2/service/sts v1.29.0 h1:dqW4XRwPE/poWSqVntpeXLHzpPK6AOfKmL9QWDYl9aw=
28+
github.com/aws/aws-sdk-go-v2/service/sts v1.29.0/go.mod h1:j8+hrxlmLR8ZQo6ytTAls/JFrt5bVisuS6PD8gw2VBw=
2929
github.com/aws/smithy-go v1.20.2 h1:tbp628ireGtzcHDDmLT/6ADHidqnwgF57XOXZe6tp4Q=
3030
github.com/aws/smithy-go v1.20.2/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E=
3131
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=

noxfile.py

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Run nox tests
2+
#
3+
# usage:
4+
# poetry run nox --error-on-external-run --reuse-venv=yes --non-interactive
5+
#
6+
# If you want to target a specific Python version, add -p parameter
7+
8+
from typing import List, Optional
9+
10+
import nox
11+
12+
PREFIX_TESTS_FUNCTIONAL = "tests/functional"
13+
PREFIX_TESTS_UNIT = "tests/unit"
14+
15+
16+
def build_and_run_test(session: nox.Session, folders: List, extras: Optional[str] = "") -> None:
17+
"""
18+
This function is responsible for setting up the testing environment and running the test suite for specific feature.
19+
20+
The function performs the following tasks:
21+
1. Installs the required dependencies for executing any test
22+
2. If the `extras` parameter is provided, the function installs the additional dependencies
23+
3. the function runs the pytest command with the specified folders as arguments, executing the test suite.
24+
25+
Parameters
26+
----------
27+
session: nox.Session
28+
The current Nox session object, which is used to manage the virtual environment and execute commands.
29+
folders: List
30+
A list of folder paths that contain the test files to be executed.
31+
extras: Optional[str]
32+
A string representing additional dependencies that should be installed for the test environment.
33+
If not provided, the function will install the project with basic dependencies
34+
"""
35+
36+
# Required install to execute any test
37+
session.install("poetry", "pytest", "pytest-mock", "pytest_socket")
38+
39+
# Powertools project folder is in the root
40+
if extras:
41+
session.install(f"./[{extras}]")
42+
else:
43+
session.install("./")
44+
45+
# Execute test in specific folders
46+
session.run("pytest", *folders)
47+
48+
49+
@nox.session()
50+
def test_with_only_required_packages(session: nox.Session):
51+
"""Tests that only depends for required libraries"""
52+
# Logger
53+
build_and_run_test(
54+
session,
55+
folders=[
56+
f"{PREFIX_TESTS_FUNCTIONAL}/logger/",
57+
],
58+
)

0 commit comments

Comments
 (0)