diff --git a/_pytest/monkeypatch.py b/_pytest/monkeypatch.py index c402213e891..c82ffd053b4 100644 --- a/_pytest/monkeypatch.py +++ b/_pytest/monkeypatch.py @@ -113,7 +113,7 @@ def setattr(self, target, name, value=notset, raising=True): For convenience you can specify a string as ``target`` which will be interpreted as a dotted import path, with the last part being the attribute name. Example: - ``monkeypatch.setattr("os.getcwd", lambda x: "/")`` + ``monkeypatch.setattr("os.getcwd", lambda: "/")`` would set the ``getcwd`` function of the ``os`` module. The ``raising`` value determines if the setattr should fail