Fix spying on a classmethod defined on a parent class.

Review Request #10072 — Created July 9, 2018 and submitted

Information

kgb
master
05a0137...

Reviewers

kgb

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.

david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to master (8ced505)