Fix spying on a classmethod defined on a parent class.
Review Request #10072 — Created July 9, 2018 and submitted — Latest diff uploaded
Spying on a classmethod of a class would cause spy leaks if the
classmethod was actually defined on a parent. All subclasses of the
parent would carry the same spy, causing false results and breakages.We now check if the classmethod being spied on now exists in a parent of
the class, and if so, we clone it. This prevents spy leaks.Unit tests were added to check this condition.
Unit tests pass on all supported versions of Python.
Tested against issues hit during development. The spies succeeded and
no longer leaked.