Support spying on unbound functions on classes.

Review Request #5910 — Created May 31, 2014 and submitted

chipx86
kgb
master
d336c8b...
kgb

spy_on() can now be called on an unbound function on a class (such as
ClassName.my_function), which is useful when the calling code doesn't
have a particular instance it's working on, but needs to spy on an
instance that will be created in the future.

This works just like spying on any other function.

Spied on an unbounded function in a unit test, was able to override the
handler for an instance created in the future.

reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        kgb/spies.py
      Ignored Files:
    
    
  2. 
      
reviewbot
  1. This is a review from Review Bot.
      Tool: Pyflakes
      Processed Files:
        kgb/spies.py
      Ignored Files:
    
    
  2. 
      
david
  1. I think the right term would be "unbound" (since the verb you're conjugating+negating is "to bind", not "to bound")

  2. 
      
chipx86
reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        kgb/spies.py
      Ignored Files:
    
    
  2. 
      
reviewbot
  1. This is a review from Review Bot.
      Tool: Pyflakes
      Processed Files:
        kgb/spies.py
      Ignored Files:
    
    
  2. 
      
david
  1. Ship It!

  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Loading...