Skip to content
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

[Python] pytest API changes make tests fail #18772

Closed
asfimport opened this issue Apr 25, 2018 · 2 comments
Closed

[Python] pytest API changes make tests fail #18772

asfimport opened this issue Apr 25, 2018 · 2 comments

Comments

@asfimport
Copy link

Seems like there is a new pytest on pypy, it produces the following failures:

=================================== FAILURES ===================================
__ TestConvertDateTimeLikeTypes.test_pandas_datetime_to_date64_failures[None] __
 
self = <pyarrow.tests.test_convert_pandas.TestConvertDateTimeLikeTypes object at 0x112dd6a90>
mask = None
 
 @pytest.mark.parametrize('mask', [
 None,
 np.ones(3),
 np.array([True, False, False])
 ])
 def test_pandas_datetime_to_date64_failures(self, mask):
 s = pd.to_datetime([
 '2018-05-10T10:24:01',
 '2018-05-11T10:24:01',
 '2018-05-12T10:24:01',
 ])
 
 expected_msg = 'Timestamp value had non-zero intraday milliseconds'
> with pytest.raises(pa.ArrowInvalid, msg=expected_msg):
E TypeError: Unexpected keyword arguments passed to pytest.raises: msg
 
pyarrow-test-3.6/lib/python3.6/site-packages/pyarrow/tests/test_convert_pandas.py:862: TypeError
_ TestConvertDateTimeLikeTypes.test_pandas_datetime_to_date64_failures[mask1] __
 
self = <pyarrow.tests.test_convert_pandas.TestConvertDateTimeLikeTypes object at 0x113213160>
mask = array([ 1., 1., 1.])
 
 @pytest.mark.parametrize('mask', [
 None,
 np.ones(3),
 np.array([True, False, False])
 ])
 def test_pandas_datetime_to_date64_failures(self, mask):
 s = pd.to_datetime([
 '2018-05-10T10:24:01',
 '2018-05-11T10:24:01',
 '2018-05-12T10:24:01',
 ])
 
 expected_msg = 'Timestamp value had non-zero intraday milliseconds'
> with pytest.raises(pa.ArrowInvalid, msg=expected_msg):
E TypeError: Unexpected keyword arguments passed to pytest.raises: msg
 
pyarrow-test-3.6/lib/python3.6/site-packages/pyarrow/tests/test_convert_pandas.py:862: TypeError
_ TestConvertDateTimeLikeTypes.test_pandas_datetime_to_date64_failures[mask2] __
 
self = <pyarrow.tests.test_convert_pandas.TestConvertDateTimeLikeTypes object at 0x112ed4c88>
mask = array([ True, False, False], dtype=bool)
 
 @pytest.mark.parametrize('mask', [
 None,
 np.ones(3),
 np.array([True, False, False])
 ])
 def test_pandas_datetime_to_date64_failures(self, mask):
 s = pd.to_datetime([
 '2018-05-10T10:24:01',
 '2018-05-11T10:24:01',
 '2018-05-12T10:24:01',
 ])
 
 expected_msg = 'Timestamp value had non-zero intraday milliseconds'
> with pytest.raises(pa.ArrowInvalid, msg=expected_msg):
E TypeError: Unexpected keyword arguments passed to pytest.raises: msg
 
pyarrow-test-3.6/lib/python3.6/site-packages/pyarrow/tests/test_convert_pandas.py:862: TypeError
=========================== short test summary info ============================

I think we can just change msg to message and it should work again.

Reporter: Philipp Moritz / @pcmoritz
Assignee: Philipp Moritz / @pcmoritz

PRs and other links:

Note: This issue was originally created as ARROW-2508. Please see the migration documentation for further details.

@asfimport
Copy link
Author

Antoine Pitrou / @pitrou:
The test is wrong, it should use the "match" argument not the "message" argument. "match" matches against the Python exception message text. "message" is the message of the error raised by pytest if the exception match fails.

See https://docs.pytest.org/en/latest/assert.html#assertions-about-expected-exceptions

@asfimport
Copy link
Author

Antoine Pitrou / @pitrou:
Issue resolved by pull request 1944
#1944

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants