summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorholger krekel <holger@merlinux.eu>2013-08-07 15:35:27 +0200
committerholger krekel <holger@merlinux.eu>2013-08-07 15:35:27 +0200
commit407283ef81e84ca163e32a2952658c85f3000609 (patch)
tree406f8b60b2d560650de4d79a19cc5bd1879b0261 /doc
parent3fddf996616177a47a2a78920215b008c6856e93 (diff)
downloadpytest-407283ef81e84ca163e32a2952658c85f3000609.tar.gz
a new monkeypatch.replace(target, value) call which derives the
monkeypatch location from target (can be class/module/function or string which is taken as importable python path) examples: monkeypatch.replace(os.path.abspath, lambda x: "") monkeypatch.replace("requests.get", ...)
Diffstat (limited to 'doc')
-rw-r--r--doc/en/monkeypatch.txt4
1 files changed, 2 insertions, 2 deletions
diff --git a/doc/en/monkeypatch.txt b/doc/en/monkeypatch.txt
index 74c63b850..78fec4155 100644
--- a/doc/en/monkeypatch.txt
+++ b/doc/en/monkeypatch.txt
@@ -29,7 +29,7 @@ patch this function before calling into a function which uses it::
def test_mytest(monkeypatch):
def mockreturn(path):
return '/abc'
- monkeypatch.setattr(os.path, 'expanduser', mockreturn)
+ monkeypatch.setattr(os.path., 'expanduser', mockreturn)
x = getssh()
assert x == '/abc/.ssh'
@@ -41,7 +41,7 @@ Method reference of the monkeypatch function argument
-----------------------------------------------------
.. autoclass:: monkeypatch
- :members: setattr, delattr, setitem, delitem, setenv, delenv, syspath_prepend, chdir, undo
+ :members: setattr, replace, delattr, setitem, delitem, setenv, delenv, syspath_prepend, chdir, undo
``monkeypatch.setattr/delattr/delitem/delenv()`` all
by default raise an Exception if the target does not exist.