-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
issue #109 Replace print statements with logger #113
Conversation
Hi @aaronchall, Before I can review this more thoroughly we need to ensure it passes tests. It seems that there is an error in the log usage: https://travis-ci.org/pypa/auditwheel/jobs/447196891#L538-L540 Can you please run the tests and work to fix this? I'm not sure at a quick glance why this is failing. |
@ehashman my apologies, we don't use github/travis where I work, most of my PR's in the past year have been for docs, and I haven't used this workflow in a long time. Tests are now passing, though! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks pretty good now, but my one concern is now there isn't any printed test output... can you either figure out how to get that to show up or revert to using print statements in the tests? It's fine for the tests to not use a logger.
@@ -46,12 +50,12 @@ def execute(args, p): | |||
try: | |||
out_wheel = add_platforms(ctx, [wheel_abi.overall_tag]) | |||
except WheelToolsError as e: | |||
print('\n%s.' % str(e), file=sys.stderr) | |||
logger.exception('\n%s.', repr(e)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
@ehashman please let me know what you think of these changes! We just need to set the logging levels for pytest (which requires pytest 3.4 or higher, I believe). |
This PR is getting a little long in the tooth so I pushed some commits to your branch that accomplish the same as what you're intending here but with less code and hardcoded configs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I am super into this. The logger means that we don't have to scatter useless print statements throughout the code and we can correctly start embedding debug statements as necessary, and tune test output by manually passing --log-cli-level
(e.g. = 10 for DEBUG).
And our test output is now looking a lot nicer! Big win, I'm going to squash and merge. 💯
@ehashman Thanks, I would have just done it as INFO/ level 20 myself but I was worried it would be too verbose for the maintainers, but I agree this is better!! I didn't realize you could configure pytest in setup.cfg either! Cheers!!! |
Thanks!
Fixes #109.