Convert all tests to pytest
See original GitHub issueA 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 #114
- test/unit/test_aws_encryption_sdk.py #115
- test/unit/test_defaults.py #116
- test/unit/test_deserialize.py #117
- test/unit/test_encryption_context.py #118
- test/unit/test_providers_base_master_key.py #119
- test/unit/test_providers_base_master_key_provider.py #120
- test/unit/test_providers_kms_master_key.py #121
- test/unit/test_providers_kms_master_key_provider.py #122
- test/unit/test_providers_raw_master_key.py #123
- test/unit/test_providers_raw_master_key_provider.py #124
- test/unit/test_serialize.py #125
- test/unit/test_streaming_client_stream_decryptor.py #126
- test/unit/test_streaming_client_stream_encryptor.py #127
- test/unit/test_util_str_ops.py #128
- test/unit/test_utils.py #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.
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
Convert all tests to pytest · Issue #468 - GitHub
Currently some tests are written in unit test and some in pytest. As pytest is more flexible all tests should be converted to...
Read more >How to go about converting a test-suite from unittest to pytest?
There seems to be a conversion tool, though I haven't tested it. Generally, I would do this incrementally - if you want to...
Read more >Effective Python Testing With Pytest
In this tutorial, you'll learn how to take your testing to the next level with pytest. You'll cover intermediate and advanced pytest ......
Read more >How to use unittest-based tests with pytest
pytest supports running Python unittest -based tests out of the box. It's meant for leveraging existing unittest -based test suites to use pytest...
Read more >Converting unittest suites to pytest - Packt Subscription
In the previous chapter, we have seen how the flexible pytest architecture has created a ... to large in-house-grown test suites that contain...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
No more
unittest
! 😃Thanks for the help, @AndresSan6
Looks like a couple had lingering minor linting issues. Just a reminder that
tox -e autoformat
should clear up most of those.