doctest and decorators
Ferenczi Viktor
python at cx.hu
Tue Sep 4 16:36:37 EDT 2007
> I assume this is a FAQ, but I couldn't find much helpful information
> googling. I'm having trouble with doctest skipping my functions, if I'm
> using decorators (that are defined in a separate module). If I'm
> understanding what is happening correctly, it's because doctest checks if
> the function's func_global attribute is the same as the module's __dict__
> attribute. The decorator in question returns a wrapping function, though,
> so this check fails.
> What are some solutions to this? I can define __test__, but it seems rather
> cumbersome.
Please take a look at the documentation of the functools standard module in
the Python manual, especially the wraps decorator. It could probably help.
Viktor
More information about the Python-list
mailing list