[pytest-dev] monkeypatch.setattr versus replace

Floris Bruynooghe flub at devork.be
Mon Sep 16 14:11:54 CEST 2013


[resending to list - apologies]

On 13 September 2013 13:32, holger krekel <holger at merlinux.eu> wrote:
>>    monkeypatch.setattr(os.path.abspath, lambda x: "/abc")
>
> It's actually possible to make this work in many common cases,
> but is bordering on the magic side.

This would actually be my favourite and is what I usually type when
I'm not thinking.  However there is nothing wrong with the
two-argument version where the first is a string either, so I'm +1 on
that.  Accepting this form is then a separate issue to consider.


Regards,
Floris


More information about the Pytest-dev mailing list