Author danilo
Recipients danilo
Date 2007-09-05.10:53:23
SpamBayes Score 0.00103886
Marked as misclassified No
Message-id <>
Seems like doctest won't recognize functions inside the module under
test are actually in that module, if the function is decorated by a
decorator that wraps the function in an externally defined function,
such as in this silly example:

import functools

def simplelog(f):
    def new_f(*args, **kwds):
        print "Wrapper calling func"
        return f(*args, **kwds)
    return new_f

from decorator import simplelog

def test():
    This test should fail, since the decorator prints output.
    Seems I don't get called though
    >>> test()
    return "works!"

if __name__ == '__main__':
    import doctest


The problem lies in DocTestFinder._from_module, which checks if the
function's func_globals attribute is the same as the module's __dict__

I'd propose to do the __module__/inspect.getmodule() checks (aren't they
 both checking the same thing btw?) before the inspect.isfunction check.
Date User Action Args
2007-09-05 10:53:25danilosetspambayes_score: 0.00103886 -> 0.00103886
recipients: + danilo
2007-09-05 10:53:24danilosetspambayes_score: 0.00103886 -> 0.00103886
messageid: <>
2007-09-05 10:53:24danilolinkissue1108 messages
2007-09-05 10:53:23danilocreate