Add a function for calling the original spied-on function.

Review Request #10631 — Created July 19, 2019 and submitted

Information

kgb
master
93f0314...

Reviewers

kgb

Sometimes it's useful to spy on a function and override it (to influence
or track some state), but to then be able to invoke the original
behavior.

This change implements this through a new call_original() function,
which will invoke the original function's bytecode. It will pass any
positional or keyword arguments to the original function, taking care to
pass the correct self or cls for bound/class methods. The call is
not logged, so it won't impact any spy tracking.

Examples of how to use this new functionality can be found in the
README.

Unit tests pass for Python 2.7, 3.5, 3.6, and 3.7.

david
  1. Ship It!
  2. 
      
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to master (902bfde)
Loading...