Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: test Python 3.12 in CI #623

Merged
merged 10 commits into from
Oct 31, 2023
1 change: 0 additions & 1 deletion .github/workflows/ci_test-vector-handler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ jobs:
- windows-latest
- macos-latest
python:
- 3.7
- 3.8
- 3.x
architecture:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ jobs:
- 3.9
- "3.10"
- "3.11"
- 3.x # Ideally, we would skip if 3.x is 3.11
- "3.12"
- 3.x
architecture:
- x64
- x86
Expand Down
13 changes: 13 additions & 0 deletions buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,20 @@ batch:
- identifier: py310_awses_latest
buildspec: codebuild/py310/awses_local.yml

- identifier: py311_integ
buildspec: codebuild/py311/integ.yml
- identifier: py311_examples
buildspec: codebuild/py311/examples.yml
- identifier: py311_awses_latest
buildspec: codebuild/py311/awses_local.yml

- identifier: py312_integ
buildspec: codebuild/py312/integ.yml
- identifier: py312_examples
buildspec: codebuild/py312/examples.yml
- identifier: py312_awses_latest
buildspec: codebuild/py312/awses_local.yml

- identifier: code_coverage
buildspec: codebuild/coverage/coverage.yml

Expand Down
27 changes: 27 additions & 0 deletions codebuild/py311/awses_local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version: 0.2

env:
variables:
TOXENV: "py311-awses_local"
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_KEY_ID: >-
arn:aws:kms:us-west-2:658956600833:key/b3537ef1-d8dc-4780-9f5a-55776cbb2f7f
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_KEY_ID_2: >-
arn:aws:kms:eu-central-1:658956600833:key/75414c93-5285-4b57-99c9-30c1cf0a22c2
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_MRK_KEY_ID_1: >-
arn:aws:kms:us-west-2:658956600833:key/mrk-80bd8ecdcd4342aebd84b7dc9da498a7
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_MRK_KEY_ID_2: >-
arn:aws:kms:us-east-1:658956600833:key/mrk-80bd8ecdcd4342aebd84b7dc9da498a7
AWS_ENCRYPTION_SDK_PYTHON_DECRYPT_ORACLE_API_DEPLOYMENT_ID: "xi1mwx3ttb"
AWS_ENCRYPTION_SDK_PYTHON_DECRYPT_ORACLE_REGION: "us-west-2"

phases:
install:
runtime-versions:
python: latest
build:
commands:
- pyenv install 3.11.0
- pyenv local 3.11.0
- pip install "tox < 4.0"
- cd test_vector_handlers
- tox
24 changes: 24 additions & 0 deletions codebuild/py311/examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: 0.2

env:
variables:
TOXENV: "py311-examples"
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_KEY_ID: >-
arn:aws:kms:us-west-2:658956600833:key/b3537ef1-d8dc-4780-9f5a-55776cbb2f7f
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_KEY_ID_2: >-
arn:aws:kms:eu-central-1:658956600833:key/75414c93-5285-4b57-99c9-30c1cf0a22c2
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_MRK_KEY_ID_1: >-
arn:aws:kms:us-west-2:658956600833:key/mrk-80bd8ecdcd4342aebd84b7dc9da498a7
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_MRK_KEY_ID_2: >-
arn:aws:kms:us-east-1:658956600833:key/mrk-80bd8ecdcd4342aebd84b7dc9da498a7

phases:
install:
runtime-versions:
python: latest
build:
commands:
- pyenv install 3.11.0
- pyenv local 3.11.0
- pip install "tox < 4.0"
- tox
24 changes: 24 additions & 0 deletions codebuild/py311/integ.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: 0.2

env:
variables:
TOXENV: "py311-integ"
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_KEY_ID: >-
arn:aws:kms:us-west-2:658956600833:key/b3537ef1-d8dc-4780-9f5a-55776cbb2f7f
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_KEY_ID_2: >-
arn:aws:kms:eu-central-1:658956600833:key/75414c93-5285-4b57-99c9-30c1cf0a22c2
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_MRK_KEY_ID_1: >-
arn:aws:kms:us-west-2:658956600833:key/mrk-80bd8ecdcd4342aebd84b7dc9da498a7
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_MRK_KEY_ID_2: >-
arn:aws:kms:us-east-1:658956600833:key/mrk-80bd8ecdcd4342aebd84b7dc9da498a7

phases:
install:
runtime-versions:
python: latest
build:
commands:
- pyenv install 3.11.0
- pyenv local 3.11.0
- pip install "tox < 4.0"
- tox
27 changes: 27 additions & 0 deletions codebuild/py312/awses_local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version: 0.2

env:
variables:
TOXENV: "py312-awses_local"
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_KEY_ID: >-
arn:aws:kms:us-west-2:658956600833:key/b3537ef1-d8dc-4780-9f5a-55776cbb2f7f
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_KEY_ID_2: >-
arn:aws:kms:eu-central-1:658956600833:key/75414c93-5285-4b57-99c9-30c1cf0a22c2
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_MRK_KEY_ID_1: >-
arn:aws:kms:us-west-2:658956600833:key/mrk-80bd8ecdcd4342aebd84b7dc9da498a7
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_MRK_KEY_ID_2: >-
arn:aws:kms:us-east-1:658956600833:key/mrk-80bd8ecdcd4342aebd84b7dc9da498a7
AWS_ENCRYPTION_SDK_PYTHON_DECRYPT_ORACLE_API_DEPLOYMENT_ID: "xi1mwx3ttb"
AWS_ENCRYPTION_SDK_PYTHON_DECRYPT_ORACLE_REGION: "us-west-2"

phases:
install:
runtime-versions:
python: latest
build:
commands:
- pyenv install 3.12.0
- pyenv local 3.12.0
- pip install "tox < 4.0"
- cd test_vector_handlers
- tox
24 changes: 24 additions & 0 deletions codebuild/py312/examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: 0.2

env:
variables:
TOXENV: "py312-examples"
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_KEY_ID: >-
arn:aws:kms:us-west-2:658956600833:key/b3537ef1-d8dc-4780-9f5a-55776cbb2f7f
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_KEY_ID_2: >-
arn:aws:kms:eu-central-1:658956600833:key/75414c93-5285-4b57-99c9-30c1cf0a22c2
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_MRK_KEY_ID_1: >-
arn:aws:kms:us-west-2:658956600833:key/mrk-80bd8ecdcd4342aebd84b7dc9da498a7
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_MRK_KEY_ID_2: >-
arn:aws:kms:us-east-1:658956600833:key/mrk-80bd8ecdcd4342aebd84b7dc9da498a7

phases:
install:
runtime-versions:
python: latest
build:
commands:
- pyenv install 3.12.0
- pyenv local 3.12.0
- pip install "tox < 4.0"
- tox
24 changes: 24 additions & 0 deletions codebuild/py312/integ.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: 0.2

env:
variables:
TOXENV: "py312-integ"
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_KEY_ID: >-
arn:aws:kms:us-west-2:658956600833:key/b3537ef1-d8dc-4780-9f5a-55776cbb2f7f
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_KEY_ID_2: >-
arn:aws:kms:eu-central-1:658956600833:key/75414c93-5285-4b57-99c9-30c1cf0a22c2
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_MRK_KEY_ID_1: >-
arn:aws:kms:us-west-2:658956600833:key/mrk-80bd8ecdcd4342aebd84b7dc9da498a7
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_MRK_KEY_ID_2: >-
arn:aws:kms:us-east-1:658956600833:key/mrk-80bd8ecdcd4342aebd84b7dc9da498a7

phases:
install:
runtime-versions:
python: latest
build:
commands:
- pyenv install 3.12.0
- pyenv local 3.12.0
- pip install "tox < 4.0"
- tox
1 change: 1 addition & 0 deletions dev_requirements/ci-requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
setuptools
tox==3.27.1
24 changes: 11 additions & 13 deletions test/unit/test_caches_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,16 @@


def test_abstracts():
with pytest.raises(TypeError) as excinfo:
with pytest.raises(TypeError, match='instantiate abstract class CryptoMaterialsCache') as excinfo:
CryptoMaterialsCache()

excinfo.match(
r"Can't instantiate abstract class CryptoMaterialsCache with abstract methods {}".format(
", ".join(
[
"get_decryption_materials",
"get_encryption_materials",
"put_decryption_materials",
"put_encryption_materials",
]
)
)
)
exception = str(excinfo.value)
method_names = [
"get_decryption_materials",
"get_encryption_materials",
"put_decryption_materials",
"put_encryption_materials"
]
for name in method_names:
if exception.rfind(name) == -1:
raise AssertionError("{} missing from Exception Message".format(name))
13 changes: 6 additions & 7 deletions test/unit/test_material_managers_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@


def test_abstracts():
with pytest.raises(TypeError) as excinfo:
with pytest.raises(TypeError, match='instantiate abstract class CryptoMaterialsManager') as excinfo:
CryptoMaterialsManager()

excinfo.match(
r"Can't instantiate abstract class CryptoMaterialsManager with abstract methods {}".format(
", ".join(["decrypt_materials", "get_encryption_materials"])
)
)
method_names = ["decrypt_materials", "get_encryption_materials"]
exception = str(excinfo.value)
for name in method_names:
if exception.rfind(name) == -1:
raise AssertionError("{} missing from Exception Message".format(name))
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
envlist =
py{37,38,39,310,311}-{local,integ,accept,examples}, nocmk,
py{38,39,310,311,312}-{local,integ,accept,examples}, nocmk,
texastony marked this conversation as resolved.
Show resolved Hide resolved
bandit, doc8, readme, docs,
{flake8,pylint}{,-tests,-examples},
isort-check, black-check,
Expand Down