-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Improve error message on failing test_pyplot_up_to_date #12537
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
Conversation
5f874a2
to
f42c016
Compare
lib/matplotlib/tests/test_pyplot.py
Outdated
fromfile='found pyplot.py', | ||
tofile='expected pyplot.py', | ||
n=0, lineterm='')) | ||
raise AssertionError( |
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.
Can use either
assert success_cond, error_msg
or
if fail_cond: pytest.fail(error_msg)
either of which seem mildly preferable to throwing AssertionError explicitly.
n=0, lineterm='')) | ||
raise AssertionError( | ||
"pyplot.py is not up-to-date. Please run " | ||
"'python tools/boilerplate.py' to update pyplot.py. " |
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.
Note that this typically needs to be done from an environment where the current matplotlib is installed (e.g. pip install -e
'd).
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.
Done for now. Should we modify boilerplate.py
to import the adjacent matplotlib, even if it is not installed? IMO it makes sense to import local if we want to update the local pyplot.
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.
Should we modify boilerplate.py to import the adjacent matplotlib, even if it is not installed? IMO it makes sense to import local if we want to update the local pyplot.
But you have no guarantees that e.g. the extension modules are built, so you can fail with ImportError. Seems easier to just ask for it to be installed...
…o pyplot-test-message
PR Summary
test_pyplot_up_to_date()
produces a long error message, but it's hard for the inexperienced contributor to understand what is going wrong and how to fix it.This PR produces a shorter and more meaningful error message.