1 new commit in pytest: https://bitbucket.org/hpk42/pytest/commits/5260ac5bdfc0/ Changeset: 5260ac5bdfc0 User: hpk42 Date: 2013-08-09 10:22:49 Summary: add a note about how a lightweight but more powerful function-mocker could be done (compared to standard mock). Affected #: 1 file
diff -r 0b6a0bdf323c1ea00b9cac7e0e7c3527107038a1 -r 5260ac5bdfc087a0e2612f4fea367d786bec42ba ISSUES.txt --- 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 Repository URL: https://bitbucket.org/hpk42/pytest/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. _______________________________________________ pytest-commit mailing list pytest-commit@python.org http://mail.python.org/mailman/listinfo/pytest-commit