context_tools

The contextlib module that ships with Python 2.5 and newer is pretty neat; for example, it includes a tool to transform a decorator into a context manager. Neat, but not enough.

context_tools aims to pick up where contextlib leaves off. It includes tools for turning context managers into setUp() and tearDown() methods for unittest- and test_harness-based tests and into decorators for functions and generators.

Interested? Grab the latest version.

News

6 July 2007

context_tools 0.2 has been released. New in this version:

  • Support for Python 2.4. context_tools now supports Python 2.4, 2.5 and 3.0.

  • test_with() now supports multiple context managers.

  • Bug fix: yield_with() now plays better with other decorators.

Download context_tools 0.2

24 June 2007

context_tools 0.1 has been released. This is the first release, including three tools: test_with(), decorate_with() and yield_with().

Download context_tools 0.1

context_tools