published by | Adam Johnson |
---|---|
in blog | Adam Johnson |
original entry | unittest’s new context methods in Python 3.11 (with backports) |
Python 3.11 only made one change to unittest, but it’s a good one: context manager methods.
These methods can simplify setup and teardown logic in many cases, such as dynamic use of unittest.mock
.
In this post we’ll look at a couple fo examples using the new …