-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
TST: pytest.raises vs. tm.assert_raises_regex #16521
Comments
I don't think this is necessary to always check the actual content of the error, unless the content of the message is relevant (maybe to distinguish cases). |
@jreback : Fair enough, but I think in many cases, we can though. One of my arguments for using So sure, I don't think all of them need to be converted, but I still do think |
FWIW, I would like to avoid calling pytest-specific methods where possible, to make a migration away from pytest easier in the far future, if that's ever necessary. We could add a |
@TomAugspurger : That is possible, though |
I don't think this is a good reason. The good reason is that simply changing an error message can cause failures which are not immediately obvious (of course you want things to fail, but this mean that your regext could be too strict). |
@jreback : I think @TomAugspurger was somewhat separate from the main discussion. That being said, what you said is one reason why I think we should prefer |
I'm going to close this, since I think there is sufficient discussion on this matter (at least for myself 😄). Can always revisit if need be. |
@pandas-dev/pandas-core I'd like to re-open this in part because IIUC, there is some effort to make things for I would bring up a similar question for |
I'd be +1 on this. Doesn't seem like a long term fit to maintain this method in our code base |
Also +1 for using For |
Opened pytest-dev/pytest#4343 upstream in pytest.
…On Thu, Nov 8, 2018 at 7:17 AM Joris Van den Bossche < ***@***.***> wrote:
Also +1 for using pytest.raises now it has all functionality (I think?)
we need.
For pytest.warns, maybe it would a good idea if somebody finds the time
to ask pytest if they would be interested in adding such a feature.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#16521 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABQHIoEPmi7r0xtEAqmHJSUUK5p4SPgIks5utC7agaJpZM4NogdL>
.
|
pytest.raises has all of the functionality that we need from tm.assert_raises_regex. Closes pandas-devgh-16521.
pytest.raises has all of the functionality that we need from tm.assert_raises_regex. Closes pandas-devgh-16521.
The deed has been done! See #23592. |
pytest.raises has all of the functionality that we need from tm.assert_raises_regex. Closes pandas-devgh-16521.
pytest.raises has all of the functionality that we need from tm.assert_raises_regex. Closes pandas-devgh-16521.
pytest.raises has all of the functionality that we need from tm.assert_raises_regex. Closes pandas-devgh-16521.
* MAINT: tm.assert_raises_regex --> pytest.raises pytest.raises has all of the functionality that we need from tm.assert_raises_regex. Closes gh-16521. * Don't remove, just deprecate assert_raises_regex * CLN: Test cleanups and follow-ups
* MAINT: tm.assert_raises_regex --> pytest.raises pytest.raises has all of the functionality that we need from tm.assert_raises_regex. Closes pandas-devgh-16521. * Don't remove, just deprecate assert_raises_regex * CLN: Test cleanups and follow-ups
* MAINT: tm.assert_raises_regex --> pytest.raises pytest.raises has all of the functionality that we need from tm.assert_raises_regex. Closes pandas-devgh-16521. * Don't remove, just deprecate assert_raises_regex * CLN: Test cleanups and follow-ups
* MAINT: tm.assert_raises_regex --> pytest.raises pytest.raises has all of the functionality that we need from tm.assert_raises_regex. Closes pandas-devgh-16521. * Don't remove, just deprecate assert_raises_regex * CLN: Test cleanups and follow-ups
* MAINT: tm.assert_raises_regex --> pytest.raises pytest.raises has all of the functionality that we need from tm.assert_raises_regex. Closes pandas-devgh-16521. * Don't remove, just deprecate assert_raises_regex * CLN: Test cleanups and follow-ups
I'm wondering whether we should explicitly say in the docs that we prefer
tm.assert_raises_regex
overpytest.raises
unless there is no error message to provide. The former is a lot more informative from a dev-perspective as to why certain code should fail.Thoughts?
(If we can agree that we do prefer the former, I also move to convert some of the tests to use
tm.assert_raises_regex
instead ofpytest.raises
).The text was updated successfully, but these errors were encountered: