[pytest-dev] monkeypatch.setattr of functions and from imports
Carl Meyer
carl at oddbird.net
Wed Oct 23 20:41:23 CEST 2013
On 10/23/2013 12:35 PM, Carl Meyer wrote:
> On 10/23/2013 11:30 AM, Daniel Nouri wrote:
>> def test_someotherfunc(monkeypatch):
>> from b import someotherfunc
>> monkeypatch.setattr('a.somefunc', lambda: 'eh?')
>> someotherfunc()
>
> This doesn't look like correct syntax for monkeypatch.setattr. I think
> you mean:
>
> monkeypatch.setattr(a, 'somefunc', lambda: 'eh?')
Never mind this! I checked in pytest 2.3.5 on the project I had handy,
didn't realize this syntax had been added in pytest 2.4. Nice!
Carl
More information about the Pytest-dev
mailing list