KodeKabuki

Welcome, my name is Harish Mallipeddi. I work for Amazon Web Services (AWS). This blog is mostly a dump of interesting articles that I come across on the web. Topics span across multiple areas including algorithms/datastructures, NoSQL stores, database internals, web-scale challenges, and functional languages.

June 4, 2009 at 8:52pm

Home

decorators and doctests

Just ran into this issue while adding some tests to the Redis Python client. If you’re using doctests, and the method being tested is wrapped in a decorator, then your doctest for that method won’t be visible to the doctest runner. This is because when you wrap a func/method in a decorator, it loses its docstring unless you set it back explicitly. In Python 2.5, you could simply avoid this problem by using functools.wraps.