Categories
Python

python-dectest — Improved unittest.TestCase

I have released the first version of dectest for Python (Github), an improved version of unittest.TestCase. It is a drop-in replacement with two improvements:

  • decorators for tests, setup, and teardown methods. This is not only more explicit than the “magic” names of unittest, it also allows multiple setup and teardown methods per class.
  • patch() helper method that calls unittest.mock.patch(), but stops the patch during teardown.