[3.7] bpo-21478: Record calls to parent when autospecced objects are used as child with attach_mock (GH 14688) by miss-islington · Pull Request #14903 · python/cpython

@tirkarthi @miss-islington

…s child with attach_mock (GH 14688)

* Clear name and parent of mock in autospecced objects used with attach_mock

* Add NEWS entry

* Fix reversed order of comparison

* Test child and standalone function calls

* Use a helper function extracting mock to avoid code duplication and refactor tests.
(cherry picked from commit 7397cda)

Co-authored-by: Xtreak <tir.karthi@gmail.com>