-
Notifications
You must be signed in to change notification settings - Fork 76
Closed
Description
Hello,
As I understood, now assert_warn just print message to stdout for warning.
https://github.com/ActivisionGameScience/assertpy/blob/master/assertpy/assertpy.py#L1104
if self.kind == 'warn':
print(out)
assert_warn - is a good idea but it's not useful in production.
I suppose to expand signature by following :
def assert_warn(val, description='', logger=None):
then, in error function:
if self.kind == 'warn':
if self.logger:
logger.warning(out)
else:
print(out) # actually it's better to print to stderr or use warning module
in this case we can pass particular logger (logging. getLogger('name') instance) or logging module to invoke warning() function. Or pass nothing to use default behavior.