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

misuse of pytest API in tests: #395

Closed
rotu opened this issue Jul 24, 2019 · 2 comments
Closed

misuse of pytest API in tests: #395

rotu opened this issue Jul 24, 2019 · 2 comments

Comments

@rotu
Copy link

rotu commented Jul 24, 2019

This error is showing up in CI:
https://ci.ros2.org/job/ci_linux/7643/testReport/rosidl_adapter.test/test_parse_message_string/test_parse_message_string/

AssertionError: assert 'foo' in '' + where '' = str()

thrown here:

with pytest.raises(ValueError) as e:
parse_message_file('pkg', filename)
assert 'foo' in str(e)

and a similar failure https://ci.ros2.org/job/ci_linux/7643/testReport/rosidl_adapter.test/test_parse_message_string/test_parse_message_string/ thrown here:

with pytest.raises(ValueError) as e:
parse_message_string('pkg', 'Foo', 'bool FOO=1\nbool FOO=1')
assert 'FOO' in str(e)

The issue is that when using with pytest.raises(...) as e, e contains an ExceptionInfo object, not the exception itself. This test should be corrected.

@rotu rotu changed the title misuse of pytest API in test_parse_message_file misuse of pytest API in tests: Jul 24, 2019
@rotu
Copy link
Author

rotu commented Jul 24, 2019

seems to be due to changing behavior of str() on ExceptionInfo objects in pytest 5: pytest-dev/pytest#5412

@rotu
Copy link
Author

rotu commented Jul 24, 2019

Fixed in #393

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

No branches or pull requests

1 participant