-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
[WIP] STY: activate pytest.raises context manager code check #25750
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
pytest.raises(AssertionError, tm.assert_numpy_array_equal, | ||
result, expected) | ||
with pytest.raises(AssertionError): | ||
tm.assert_numpy_array_equal(result, expected) |
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.
didn't convert this on first pass since test is skipped on windows. looking at it again, the assertion error check is used in lieu of a tm.assert_numpy_array_not_equal function so message check not appropriate.
# for t in ['s', 'D', 'us', 'ms']: | ||
# pytest.raises(TypeError, td.astype, 'm8[%s]' % t) | ||
# with pytest.raises(TypeError, match="<enter message here>"): | ||
# td.astype('m8[%s]' % t) |
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.
does not raise. added a TODO. not in this PR though.
pytest.raises(Exception, lambda x: DataFrame( | ||
[[1, 2, 'foo', 'bar']], columns=['a', 'a', 'a', 'a'])) | ||
# with pytest.raises(Exception, match="<enter message here>"): | ||
# DataFrame([[1, 2, 'foo', 'bar']], columns=['a', 'a', 'a', 'a']) |
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.
does not raise. added a TODO. not in this PR though.
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.
Was this not failing CI before?
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.
@WillAyd . case of lambda x: with no x raises TypeError and so passed CI.
@@ -6,6 +6,7 @@ | |||
from pandas import Int64Index, Interval, IntervalIndex | |||
import pandas.util.testing as tm | |||
|
|||
# TODO: unskip these tests and enter error messages for pytest.raises |
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.
this whole module is skipped. added a TODO. not in this PR though.
@@ -134,21 +134,23 @@ def test_partial_set( | |||
|
|||
def test_partial_ix_missing( | |||
self, multiindex_year_month_day_dataframe_random_data): | |||
pytest.skip("skipping for now") | |||
pytest.skip("skipping for now") # TODO: fix this |
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.
this test is skipped. added a TODO. not in this PR though.
Codecov Report
@@ Coverage Diff @@
## master #25750 +/- ##
===========================================
- Coverage 91.25% 41.74% -49.51%
===========================================
Files 172 172
Lines 52977 52977
===========================================
- Hits 48343 22117 -26226
- Misses 4634 30860 +26226
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #25750 +/- ##
==========================================
- Coverage 91.25% 91.25% -0.01%
==========================================
Files 172 172
Lines 52977 52977
==========================================
- Hits 48343 48342 -1
- Misses 4634 4635 +1
Continue to review full report at Codecov.
|
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.
Just so I am clear the PRs you link to in the OP are pre-cursors to this correct?
pytest.raises(Exception, lambda x: DataFrame( | ||
[[1, 2, 'foo', 'bar']], columns=['a', 'a', 'a', 'a'])) | ||
# with pytest.raises(Exception, match="<enter message here>"): | ||
# DataFrame([[1, 2, 'foo', 'bar']], columns=['a', 'a', 'a', 'a']) |
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.
Was this not failing CI before?
not necessarily. Holding off pytables conversion to avoid overlapping PRs but this could be done now. The other PR is more than required to activate the code check so the minimum change could be added here. |
superseded by #25866 |
xref #24332