Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

log warning for assert_warn #97

Copy link
Copy link
@p-frolov

Description

@p-frolov
Issue body actions

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.

Reactions are currently unavailable

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.