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 mariocj89
Recipients mariocj89
Date 2018-10-27.10:45:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1540637110.3.0.788709270274.issue35082@psf.upfronthosting.co.za>
In-reply-to
Content
Calling dir on unittest.mock.Mock will return deleted attributes.

This is a result of the way del is implemented in Mock, which just sets a sentinel in the child mocks, so an AttributeError is raised if the attribute is later accessed.

We can just check for such sentinel in the __dir__ method and not return those.
History
Date User Action Args
2018-10-27 10:45:10mariocj89setrecipients: + mariocj89
2018-10-27 10:45:10mariocj89setmessageid: <1540637110.3.0.788709270274.issue35082@psf.upfronthosting.co.za>
2018-10-27 10:45:10mariocj89linkissue35082 messages
2018-10-27 10:45:10mariocj89create