Part of lp.testing.fakemethod View In Hierarchy
Known subclasses: lp.archivepublisher.tests.test_signing.FakeMethodCallLog
Use this for easy stubbing. The call operator can return a fixed value, or raise a fixed exception object.
This is useful when unit-testing code that does things you don't want to integration-test, e.g. because it wants to talk to remote systems.
Method | __init__ | Set up a fake function or method. |
Method | __call__ | Catch an invocation to the method. |
Method | call_count | Undocumented |
Method | extract_args | Return just the calls' positional-arguments tuples. |
Method | extract_kwargs | Return just the calls' keyword-arguments dicts. |
Parameters | result | Value to return. |
failure | Exception to raise. |
Increment call_count
, and adds the arguments to calls
.
Accepts any and all parameters. Raises the failure passed to the constructor, if any; otherwise, returns the result value passed to the constructor.