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

Add compatibility for pytest>=4 #9

Merged
merged 1 commit into from
Jan 28, 2019
Merged

Conversation

wesleykendall
Copy link
Contributor

@dcramer , I wanted to get #7 across the finish line. This addresses #8 and adds compatibility for pytest 4 (specifically 4.1 that removes a deprecated API)

This PR maintains backwards compatibility. I wasn't sure of the best method for comparing version numbers, so I'm happy to quickly implement any suggestions. I also updated the travis.yml to explicitly test against 3.5 with python 3.6. Let me know if there is a better version to test against in the pytest 3 series.

@wesleykendall
Copy link
Contributor Author

I'm giving a pytest talk at the Django meetup in San Francisco on Wednesday. Was hoping to use this plugin in the talk. But I can continue to use the normal responses library if we can't get it in before then :)

if LooseVersion(pytest.__version__) >= LooseVersion('4.0.0'):
return item.get_closest_marker('withoutresponses')
else:
return item.get_marker('withoutresponses')
Copy link
Contributor Author

@wesleykendall wesleykendall Jan 28, 2019

Choose a reason for hiding this comment

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

I thought about just checking for the get_closest_marker attribute instead of doing a version comparison. Open to suggestions

@@ -1,4 +1,4 @@
[pytest]
[tool:pytest]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not entirely sure when the tool:pytest syntax was supported by pytest, but it breaks for me when using the old syntax with pytest 4. If there's no way to maintain compatibility between 3/4 here, might as well go back to a pytest.ini

Copy link
Member

Choose a reason for hiding this comment

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

been supported for a long time iirc so this should be totally fine

Copy link

Choose a reason for hiding this comment

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

JFI: pytest 4.4 will not error out anymore with [tool:pytest] and [pytest] - pytest-dev/pytest#5008.

@dcramer dcramer merged commit af9f2fc into getsentry:master Jan 28, 2019
@wesleykendall
Copy link
Contributor Author

Wow that was fast! Thanks

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.

3 participants