In this guest post Giuseppe shares what he learned having to cleanup a large number of objects in an S3 bucket. He introduces us to some boto3 as well as moto and freezegun he used to test his code. Enter Giuseppe …
Articles on mock
Enough pytest to be Dangerous, 10 Things I Learned Writing Tests for 100 Python (Bites of Py) Exercises
By Bob Belderbos on 7 June 2018
We hit 100 Bite exercises on our Code Platform and that means we have written tests for 100 exercises. In this article I share 10 things I learned about writing test code and pytest.
Parsing Twitter Geo Data and Mocking API Calls by Example
By Bob Belderbos on 17 June 2017
“Is this Bob or Julian?!” … yeah tweeting from our shared @pybites Twitter account can be confusing! So I made a little script to parse the location of our tweets. Then I extended it to make it testable. I wrote a decorator to cache a couple of API outputs to be used with the unittest.mock patch decorator I learned about. A simple script turned into a good learning exercise.