doctest and decorators

Michele Simionato michele.simionato at gmail.com
Wed Sep 5 01:35:37 EDT 2007


> En Tue, 04 Sep 2007 19:29:11 -0300, Daniel Larsson
> <daniel.j.lars... at gmail.com> escribi?:
>
>
>
> > On 9/5/07, Ferenczi Viktor <pyt... at cx.hu> wrote:
>
> >> > > @functools.wraps(f)
> >> > > Pass the function to be wrapped by the decorator to the wraps
> >> function.
> >> > Ooops, right. That doesn't change the fact that decorated functions
> >> get
> >> > hidden from doctest though.
>
> > I have no issue when the decorator is defined in the same module as the
> > decorated function, my problem is running doctests on functions using an
> > imported decorator. Having to implement the decorator in every source
> > module
> > isn't very practical.

I cannot reproduce your problem. Using functools.wraps
the __module__ attribute is set correctly and everything
works, even for decorators defined in separated modules.
Care to post a complete example of what you are doing?

         Michele Simionato

P.S. for some reason your messages are not appearing on
Google groups, I see only the replies.




More information about the Python-list mailing list