From 654212d93ba5c9a412c9734af832c6a1172152a5 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Fri, 9 Aug 2013 10:22:49 +0200 Subject: [PATCH] add a note about how a lightweight but more powerful function-mocker could be done (compared to standard mock). --- ISSUES.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/ISSUES.txt b/ISSUES.txt index f1cfeb892..b02a7a683 100644 --- a/ISSUES.txt +++ b/ISSUES.txt @@ -1,5 +1,23 @@ +recorder = monkeypatch.function(".......") +------------------------------------------------------------- +tags: nice feature + +Like monkeypatch.replace but sets a mock-like call recorder: + + recorder = monkeypatch.function("os.path.abspath") + recorder.set_return("/hello") + os.path.abspath("hello") + call, = recorder.calls + assert call.args.path == "hello" + assert call.returned == "/hello" + ... + +Unlike mock, "args.path" acts on the parsed auto-spec'ed ``os.path.abspath`` +so it's independent from if the client side called "os.path.abspath(path=...)" +or "os.path.abspath('positional')". + refine parametrize API ------------------------------------------------------------- tags: critical feature