New submission from Mario Corchero <[email protected]>:

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.

----------
components: Library (Lib)
messages: 328647
nosy: mariocj89
priority: low
severity: normal
status: open
title: Mock.__dir__ lists deleted attributes
type: enhancement
versions: Python 3.8

_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue35082>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to