Use py.test monkeypatch instead of mock patch