diff --git a/doc/monkeypatch.txt b/doc/monkeypatch.txt index 668e9bba6..1d46ffe0a 100644 --- a/doc/monkeypatch.txt +++ b/doc/monkeypatch.txt @@ -24,14 +24,14 @@ patch this function before calling into a function which uses it:: import os.path def getssh(): # pseudo application code - return os.path.join(os.expanduser("~admin"), '.ssh') + return os.path.join(os.path.expanduser("~admin"), '.ssh') def test_mytest(monkeypatch): def mockreturn(path): return '/abc' monkeypatch.setattr(os.path, 'expanduser', mockreturn) x = getssh() - assert x == '/abc' + assert x == '/abc/.ssh' After the test function finishes the ``os.path.expanduser`` modification will be undone.