Convert all tests to pytest · Issue #99 · aws/aws-encryption-sdk-python (original) (raw)
A lot of the original test suite was written in unittest
. Let's get all of that moved over to pytest
.
Initially, this should be converting unittest.TestCase
classes to pytest
classes similar to what was done in #98. We can pull those methods out to stand-alone functions later if we decide we want to, but leaving them in classes will make the diffs most simpler.
I would also like to opportunistically remove some of the over-zealous mocking present in these classes where we can.
Test modules to convert:
- test/integration/test_i_aws_encrytion_sdk_client.py Migrate test_i_aws_encryption_sdk_client.py from unittet to pytest #114
- test/unit/test_aws_encryption_sdk.py Migrated "test/unit/test_aws_encryption_sdk.py" from unittest to pytest #115
- test/unit/test_defaults.py Migrate unit/test_defaults.py from unittest to pytest #116
- test/unit/test_deserialize.py Migrate unit/test_deserialize.py from unittest from pytest #117
- test/unit/test_encryption_context.py Migrate unit/test_encryption_context.py from unittest to pytest #118
- test/unit/test_providers_base_master_key.py Migrate "test/unit/test_providers_base_master_key.py" from unittest to pytest #119
- test/unit/test_providers_base_master_key_provider.py Migrate "test/unit/test_providers_base_master_key_provider.py" from unittest to pytest #120
- test/unit/test_providers_kms_master_key.py Migrate "test/unit/test_providers_kms_master_key.py" from unittest to pytest #121
- test/unit/test_providers_kms_master_key_provider.py Migrate "test/unit/test_providers_kms_master_key_provider.py" from unittest to pytest #122
- test/unit/test_providers_raw_master_key.py Migrate "test/unit/test_providers_raw_master_key.py" from unittest to pytest #123
- test/unit/test_providers_raw_master_key_provider.py Migrate "test/unit/test_providers_raw_master_key_provider.py" from unittest to pytest #124
- test/unit/test_serialize.py Migrate "test/unit/test_serialize.py" from unittest to pytest #125
- test/unit/test_streaming_client_stream_decryptor.py Migrate "test/unit/test_streaming_client_stream_decryptor.py" from unittest to pytest #126
- test/unit/test_streaming_client_stream_encryptor.py Migrate unit/test_streaming_client_stream_encryptor.py from unittest to pytest #127
- test/unit/test_util_str_ops.py Migrate unit/test_util_str_ops.py from unittest to pytest #128
- test/unit/test_utils.py Migrate unit/test_utils.py from unittest to pytest #129
Due to the changes that will need to happen, anyone looking at this please follow the following guidelines:
- Convert from
unittest
classes to classes usingpytest
first. We can change to functions later if desired, but converting the classes directly will minimize the changes in each test file. - One test file per PR. This will minimize the amount of changes that need to be reviewed and speed up the review process.
- Run
tox -re autoformat
before committing to apply our formatting rules.