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

TST: Fix our usage of pytest ExceptionInfo. #1225

Merged
merged 1 commit into from Jul 2, 2019

Conversation

danielballan
Copy link
Member

One test has started failing consistently on the OSX builds, and the
cause is a pytest major release that dropped on June 28. Travis' Ubuntu
virtual machines come with an older version of pytest included, and we do not
force it to upgrade, so we have only encountered this on the OSX builds
so far.

The usage

with pytest.raises(Exception) as exc

puts an ExceptionInfo
object into exc, not the exception itself. We were trying exc
like an exception object and relying on the fact that
ExceptionInfo.__str__ returned the same thing as exc.__str__
would. The
pytest 5.0.0 release
broke that assumption. See pytest-dev/pytest#5412.

One test has started failing consistently on the OSX builds, and the
cause is a pytest major release that dropped on June 28. Travis' Ubuntu
virtual machines come with an older version of pytest included, and we do not
force it to upgrade, so we have only encountered this on the OSX builds
so far.

The usage

```python
with pytest.raises(Exception) as exc
```

puts an [``ExceptionInfo``](https://docs.pytest.org/en/latest/reference.html#exceptioninfo)
object into ``exc``, not the exception itself. We were trying ``exc``
like an exception object and relying on the fact that
``ExceptionInfo.__str__`` returned the same thing as ``exc.__str__``
would. The
[pytest 5.0.0 release](https://docs.pytest.org/en/latest/changelog.html#pytest-5-0-0-2019-06-28)
broke that assumption. See pytest-dev/pytest#5412.
Copy link
Member

@mrakitin mrakitin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! I am glad we don't rely on a single OS/approach for testing, so that these kinds of issues can be uncovered early.

@jklynch jklynch merged commit 8e80a77 into bluesky:master Jul 2, 2019
@danielballan danielballan deleted the fix-pytest-excinfo-usage branch July 2, 2019 13:53
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

Successfully merging this pull request may close these issues.

None yet

3 participants