Harish Mallipeddi RSS

Avid Pythonista with a secret love for Erlang.

harish.mallipeddi at gmail

 Photos

 LinkedIn

 Twitter

 Projects

Older posts

Jun
4th
Thu
permalink

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.

Comments
blog comments powered by Disqus