Improve the error for unexpected function call spies in operations.

Review Request #11798 — Created Aug. 20, 2021 and submitted — Latest diff uploaded

Information

kgb
master

Reviewers

kgb

In match-based spy operations, exceptions are raised when a call is made
to a spy that either exceeds or doesn't match the list of expected
calls.

To help with debugging these situations, the exception now includes the
call that triggered the exception.

This uncovered an issue in SpyCall.__repr__ where a ) was missing
near the end of the string.

Unit tests pass on Python 2 and 3.

Diff Revision 2 (Latest)

orig
1
2

Commits

First Last Summary ID Author
Improve the error for unexpected function call spies in operations.
In match-based spy operations, exceptions are raised when a call is made to a spy that either exceeds or doesn't match the list of expected calls. To help with debugging these situations, the exception now includes the call that triggered the exception. This uncovered an issue in `SpyCall.__repr__` where a `)` was missing near the end of the string.
a12455929d5fa328f8f0075c5eee014d9d587835 Christian Hammond
kgb/calls.py
kgb/ops.py
kgb/tests/test_ops.py
Loading...