-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
Conversation
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') |
There was a problem hiding this comment.
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] |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
Wow that was fast! Thanks |
@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.