Re: doctest and decorators

2007-09-05 Thread Michele Simionato
On 9/5/07, Daniel Larsson <[EMAIL PROTECTED]> wrote: > Here's my two files again: > > # decorator.py > import functools > > def simplelog(f): > @functools.wraps(f) > def new_f(*args, **kwds): > print "Wrapper calling func" > return f(*args, **kwds) > return new_

Re: doctest and decorators

2007-09-05 Thread Daniel Larsson
The __module__ attribute is set, but the problem is the test in doctest.py(DocTestFinder._from_module) ... elif inspect.isfunction(object): return module.__dict__ is object.func_globals elif inspect.isclass(object): return module.__name__ == object._

Re: doctest and decorators

2007-09-04 Thread Michele Simionato
> En Tue, 04 Sep 2007 19:29:11 -0300, Daniel Larsson > <[EMAIL PROTECTED]> escribi?: > > > > > On 9/5/07, Ferenczi Viktor <[EMAIL PROTECTED]> wrote: > > >> > > @functools.wraps(f) > >> > > Pass the function to be wrapped by the decorator to the wraps > >> function. > >> > Ooops, right. That doesn't

Re: doctest and decorators

2007-09-04 Thread Daniel Larsson
On 9/5/07, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > > En Tue, 04 Sep 2007 19:29:11 -0300, Daniel Larsson > <[EMAIL PROTECTED]> escribi�: > > > On 9/5/07, Ferenczi Viktor <[EMAIL PROTECTED]> wrote: > >> > >> > > @functools.wraps(f) > >> > > Pass the function to be wrapped by the decorator to t

Re: doctest and decorators

2007-09-04 Thread Gabriel Genellina
En Tue, 04 Sep 2007 19:29:11 -0300, Daniel Larsson <[EMAIL PROTECTED]> escribi�: > On 9/5/07, Ferenczi Viktor <[EMAIL PROTECTED]> 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

Re: doctest and decorators

2007-09-04 Thread Daniel Larsson
On 9/5/07, Ferenczi Viktor <[EMAIL PROTECTED]> 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 de

Re: doctest and decorators

2007-09-04 Thread Ferenczi Viktor
> > @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. Run my test script (one file) with the -v (verbose) option. Without the -v option it does not

Re: doctest and decorators

2007-09-04 Thread Daniel Larsson
On 9/4/07, Ferenczi Viktor <[EMAIL PROTECTED]> wrote: > > > @functools.wraps > > Correctly: > > @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. -- h

Re: doctest and decorators

2007-09-04 Thread Ferenczi Viktor
> @functools.wraps Correctly: @functools.wraps(f) Pass the function to be wrapped by the decorator to the wraps function. Regards, Viktor -- http://mail.python.org/mailman/listinfo/python-list

Re: doctest and decorators

2007-09-04 Thread Daniel Larsson
On 9/4/07, Ferenczi Viktor <[EMAIL PROTECTED]> wrote: > > > 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

Re: doctest and decorators

2007-09-04 Thread Ferenczi Viktor
> 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 funct