-
-
Notifications
You must be signed in to change notification settings - Fork 18k
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
MAINT: Remove assertRaises from testing #16089
Conversation
Codecov Report
@@ Coverage Diff @@
## master #16089 +/- ##
=======================================
Coverage 90.84% 90.84%
=======================================
Files 159 159
Lines 50771 50771
=======================================
Hits 46125 46125
Misses 4646 4646
Continue to review full report at Codecov.
|
thanks! awesome job! |
FYI (for future PR's), with pytest.raises(cls) as exc_info:
...
exc_info.matches(regexp) I stumbled upon this while doing this massive PR. Removing |
hmm, that's going to be a change, though ok with it if its documented :> can you create a context manager which emulated |
Yes, I added that in this PR.
I think the name is alright, and we do have a context manager for this (it's a port of Python 2.7's implementation). |
@gfyoung what is wrong with |
It isn't idiomatic under the pytest framework. Also, it is a port of Python's unittest |
Why isn't it idiomatic? I think it is very similar to And it is not because it is a port of a unittest function, that it is bad? |
i agree with joris |
The docs explicitly address Also, I don't know what you think about this, but what about I'm not pushing these very hard (I ask because they are the |
Rewrite _AssertRaisesContextManager with more documentation and remove vestigial assertRaises. Follow-up to pandas-devgh-16089.
Rewrite _AssertRaisesContextManager with more documentation and remove vestigial assertRaises. Follow-up to pandas-devgh-16089.
Rewrite _AssertRaisesContextManager with more documentation and remove vestigial assertRaises. Follow-up to pandas-devgh-16089.
Rewrite _AssertRaisesContextManager with more documentation and remove vestigial assertRaises. Follow-up to pandas-devgh-16089.
* MAINT: Refactor _AssertRaisesContextManager Rewrite _AssertRaisesContextManager with more documentation and remove vestigial assertRaises. Follow-up to gh-16089. * MAINT: Remove assertNotIn from testing
I still think a helper function is more easy to use than what the pytest docs propose to do (but nice docs actually!), but based on what they do, we can probably simplify the current implementation of |
The current implementation of |
What I meant was that wrapping the code snippet you gave above in a new contextmanager, may be less code than the current implementation (thus, using the pytest functionality for asserting the raised error, checking the error message). |
Hmmm...I'm not sure how worthwhile that may be since you have to consider both cases when it is used as a context manager ( |
This method was removed in pandas-dev/pandas#16089 in favor of pytest.raises.
* MAINT: Refactor _AssertRaisesContextManager Rewrite _AssertRaisesContextManager with more documentation and remove vestigial assertRaises. Follow-up to pandas-devgh-16089. * MAINT: Remove assertNotIn from testing
This method was removed in pandas-dev/pandas#16089 in favor of pytest.raises.
* TST: Fix broken tests failing with 'NoneType' object is not iterable * MAINT: pandas.util.testing.assertRaises removed This method was removed in pandas-dev/pandas#16089 in favor of pytest.raises. * MAINT: pandas.util.testing.assert_equals removed This method was removed in pandas-dev/pandas#16017 in favor of pytest.raises.
This method was removed in pandas-dev/pandas#16089 in favor of pytest.raises.
This method was removed in pandas-dev/pandas#16089 in favor of pytest.raises.
This method was removed in pandas-dev/pandas#16089 in favor of pytest.raises.
* BUG: oauth2client deprecated, use google-auth instead. Remove the use of oauth2client and use google-auth library, instead. See GH#37. Rather than check for multiple versions of the libraries, use the setup.py to specify compatible versions. I believe this is safe since Pandas checks for the pandas_gbq package. Since google-auth does not use the argparse module to override user authentication flow settings, add a parameter to choose between the web and console flow. Addresses some eventual consistency issues in table/dataset listing in the integration tests. * MAINT: pandas.util.testing.assertRaises removed This method was removed in pandas-dev/pandas#16089 in favor of pytest.raises. * MAINT: pandas.util.testing.assert_equals removed This method was removed in pandas-dev/pandas#16017 in favor of pytest.raises. * DOC: add version tags for new auth_local_webserver params. * CLN: share _test_imports between main module and tests * TST: pin versions on 3.5 rather than 2.7.
Title is self-explanatory. Pretty hefty PR this one.
Partially addresses #15990.