bpo-30541: Add new method to seal mocks (GH61923)

The new method allows the developer to control when to stop the
feature of mocks that automagically creates new mocks when accessing
an attribute that was not declared before

Signed-off-by: Mario Corchero <mariocj89@gmail.com>
This commit is contained in:
Mario Corchero 2017-10-17 12:35:11 +01:00 committed by Victor Stinner
parent 2bd37c227e
commit 552be9d7e6
5 changed files with 249 additions and 2 deletions

View file

@ -304,6 +304,11 @@ The :const:`~unittest.mock.sentinel` attributes now preserve their identity
when they are :mod:`copied <copy>` or :mod:`pickled <pickle>`. (Contributed by
Serhiy Storchaka in :issue:`20804`.)
New function :const:`~unittest.mock.seal` will disable the creation of mock
children by preventing to get or set any new attribute on the sealed mock.
The sealing process is performed recursively. (Contributed by Mario Corchero
in :issue:`30541`.)
xmlrpc.server
-------------