arcpy.Add Warning could just throw a normal warning. Doe make sense to you people need to do a wrapper every time in a pyt, toolbox and the like just to test?
def scriptwarning(func):
"""
Arcpy Warning Wraper
:param func:
:return:
"""
def wrap(*args, **kwargs):
result = func(*args, **kwargs)
warnings.warn(*args)
return result
return wrap
arcpy.AddWarning = scriptwarning(arcpy.AddWarning)
I don`t like doing it, it seams crazily wrong, for something simple.
If arcpy throws a warning why should I wrap it to test and get an expected warning?