def property_mock(request, cls, prop_name, **kwargs):
 _patch = patch.object(cls, prop_name, new_callable=PropertyMock, **kwargs)
 request.addfinalizer(_patch.stop)
 return _patch.start()

def property_mock ( request , cls , prop_name , ** kwargs ) : _patch = patch . object ( cls , prop_name , new_callable = PropertyMock , ** kwargs ) request . addfinalizer ( _patch . stop ) return _patch . start ( )
return a mock for property *prop_name* on class *cls* where the patch is reversed after pytest uses it .