Skip to content
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

Merged
merged 12 commits into from
Nov 13, 2018

Conversation

aaronchall
Copy link
Contributor

@aaronchall aaronchall commented Oct 27, 2018

Thanks!

Fixes #109.

@ehashman
Copy link
Member

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 ehashman self-requested a review October 28, 2018 16:11
@aaronchall
Copy link
Contributor Author

@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!

Copy link
Member

@ehashman ehashman left a 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))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@aaronchall
Copy link
Contributor Author

@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).

@ehashman
Copy link
Member

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.

Copy link
Member

@ehashman ehashman left a 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 ehashman merged commit f5af970 into pypa:master Nov 13, 2018
@aaronchall
Copy link
Contributor Author

@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!!!

@aaronchall aaronchall deleted the print_to_log branch November 13, 2018 05:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants