This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xtreak
Recipients anthony-flury, berker.peksag, cbelu, xtreak
Date 2018-10-11.10:18:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1539253100.01.0.788709270274.issue32153@psf.upfronthosting.co.za>
In-reply-to
Content
I think the original error has been fixed with issue28919 where the attribute errors are ignored while copying the functions as suggested by Anthony in solution 2. So can this issue be closed as outdated to reopen a new one for using update_wrapper as enhancement or the title can be changed to reflect the fact that autospec should now use update_wrapper instead of using _copy_func_details ? Correct me if I am wrong on the workflow to update the ticket.

Also there doesn't seem to be any test for this that can possibly added.

Current implementation : 

def _copy_func_details(func, funcopy):
    # we explicitly don't copy func.__dict__ into this copy as it would
    # expose original attributes that should be mocked
    for attribute in (
        '__name__', '__doc__', '__text_signature__',
        '__module__', '__defaults__', '__kwdefaults__',
    ):
        try:
            setattr(funcopy, attribute, getattr(func, attribute))
        except AttributeError:
            pass


Thanks
History
Date User Action Args
2018-10-11 10:18:20xtreaksetrecipients: + xtreak, berker.peksag, anthony-flury, cbelu
2018-10-11 10:18:20xtreaksetmessageid: <1539253100.01.0.788709270274.issue32153@psf.upfronthosting.co.za>
2018-10-11 10:18:20xtreaklinkissue32153 messages
2018-10-11 10:18:19xtreakcreate