Skip to content

[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

Closed
wants to merge 4 commits into from

Conversation

simonjayhawkins
Copy link
Member

@simonjayhawkins simonjayhawkins commented Mar 17, 2019

xref #24332

pytest.raises(AssertionError, tm.assert_numpy_array_equal,
result, expected)
with pytest.raises(AssertionError):
tm.assert_numpy_array_equal(result, expected)
Copy link
Member Author

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)
Copy link
Member Author

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'])
Copy link
Member Author

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.

Copy link
Member

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?

Copy link
Member Author

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
Copy link
Member Author

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
Copy link
Member Author

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
Copy link

codecov bot commented Mar 17, 2019

Codecov Report

Merging #25750 into master will decrease coverage by 49.5%.
The diff coverage is n/a.

Impacted file tree graph

@@             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
Flag Coverage Δ
#multiple ?
#single 41.74% <ø> (ø) ⬆️
Impacted Files Coverage Δ
pandas/io/formats/latex.py 0% <0%> (-100%) ⬇️
pandas/io/sas/sas_constants.py 0% <0%> (-100%) ⬇️
pandas/tseries/plotting.py 0% <0%> (-100%) ⬇️
pandas/tseries/converter.py 0% <0%> (-100%) ⬇️
pandas/io/formats/html.py 0% <0%> (-99.36%) ⬇️
pandas/core/groupby/categorical.py 0% <0%> (-95.46%) ⬇️
pandas/io/sas/sas7bdat.py 0% <0%> (-91.17%) ⬇️
pandas/io/sas/sas_xport.py 0% <0%> (-90.15%) ⬇️
pandas/core/tools/numeric.py 10.44% <0%> (-89.56%) ⬇️
pandas/io/json/normalize.py 8.16% <0%> (-88.78%) ⬇️
... and 129 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 65c0441...472e375. Read the comment docs.

@codecov
Copy link

codecov bot commented Mar 17, 2019

Codecov Report

Merging #25750 into master will decrease coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            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
Flag Coverage Δ
#multiple 89.82% <ø> (ø) ⬆️
#single 41.74% <ø> (ø) ⬆️
Impacted Files Coverage Δ
pandas/util/testing.py 88.98% <0%> (-0.1%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 65c0441...472e375. Read the comment docs.

Copy link
Member

@WillAyd WillAyd left a 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'])
Copy link
Member

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?

@WillAyd WillAyd added Testing pandas testing functions or related to the test suite Code Style Code style, linting, code_checks labels Mar 18, 2019
@simonjayhawkins
Copy link
Member Author

Just so I am clear the PRs you link to in the OP are pre-cursors to this correct?

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.

@jreback
Copy link
Contributor

jreback commented Mar 26, 2019

superseded by #25866

@jreback jreback closed this Mar 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Style Code style, linting, code_checks Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants