I can use patch to change the side effect of a method on a object. But is there a way to get the value returned by the method, modify it, and then return that object. E.g. something like
@pytest.fixture()
def foobarbaz(mocker, obj):
def side_effect(obj)
ret_val = obj.bar()
ret_val.pop("key")
return ret_val
mocker.patch("foo.bar.baz", side_effect=side_effect)
So that all that I'm doing is guaranteeing that the return value doesn't contain the specified key.