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

No need to warn when falling back to other URL #139

Merged
merged 3 commits into from Apr 21, 2022

Conversation

pllim
Copy link
Contributor

@pllim pllim commented Mar 8, 2022

It causes unnecessary failure when test suite is set up to turn all unhandled warnings to exceptions.

cc @dhomeier

@pllim
Copy link
Contributor Author

pllim commented Mar 8, 2022

How did my change break all these jobs?

@ConorMacBride
Copy link
Member

The failures in this PR are unrelated. (There's a problem with GitHub Pages.)

@dhomeier
Copy link

dhomeier commented Mar 9, 2022

+1
This would be a case for an INFO-level message, if we had such a thing; OTOH it's the point of having a list of backup URLs to try them all if necessary. Of course it should be checked at some point if the servers are still alive...

@pllim
Copy link
Contributor Author

pllim commented Apr 4, 2022

I don't understand the test failures. Did I break something?

@ConorMacBride
Copy link
Member

I don't understand the test failures. Did I break something?

No, failures are due to #140

u = urlopen(base_url + filename)
content = u.read()
except Exception as e:
self.logger.debug(f'Downloading {base_url + filename} failed: {repr(e)}')
Copy link
Contributor

Choose a reason for hiding this comment

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

I need to check this branch out and test this but:

What is the difference in output if we log at INFO vs DEBUG?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

INFO is probably more visible and might mess with tests that do caplog.

Copy link
Contributor

Choose a reason for hiding this comment

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

Surely if info will mess with caplog then so will debug (with or without -vv)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🤷

Copy link
Member

Choose a reason for hiding this comment

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

I had a look at this code. By default pytest will not show any log messages for a test that passes. So currently the debug (or info) log entry is not shown unless the test also fails. However, if you run pytest with --log-cli-level debug the debug log entries will be shown for passing tests, although this also shows a huge number of matplotlib debug messages about fonts etc. The failed download message is would probably be better as an info message anyway.

How about letting the user decide if they want a warning or not? If the URL begins with ?, e.g. --mpl-baseline-path=?https://example1.com,?https://example2.com, an info message is logged, and otherwise it issues a warning so no change in current behaviour?

pytest_mpl/plugin.py Outdated Show resolved Hide resolved
Co-authored-by: Stuart Mumford <stuart@cadair.com>
@Cadair
Copy link
Contributor

Cadair commented Apr 21, 2022

I think this is good enough, if we want to do fancier things in the future we can.

@Cadair Cadair merged commit 7cdccb7 into matplotlib:master Apr 21, 2022
@pllim pllim deleted the patch-1 branch April 21, 2022 13:25
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.

None yet

4 participants