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

Compatibility fixes for Pytest 4.0 #7

Closed
wants to merge 2 commits into from

Conversation

mixja
Copy link

@mixja mixja commented Jan 7, 2019

This PR adds compatibility with pytest version 4.0.

Currently pytest-responses does not work with pytest 4.x with the following error raised for each test:

def pytest_runtest_setup(item):
>       if not item.get_marker('withoutresponses'):
E       AttributeError: 'Function' object has no attribute 'get_marker'

The get_marker function has been removed as per pytest-dev/pytest#4546, and this PR replaces this with the get_closest_marker function.

@@ -16,7 +16,7 @@

install_requires = [
'responses',
'pytest>=2.5',
'pytest>=3.6',
Copy link
Member

Choose a reason for hiding this comment

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

sentry runs pytest 3.5 right now, our zeus project runs 3.2.x, so requiring a significantly newer version will create headaches for in-house developers

Copy link
Member

Choose a reason for hiding this comment

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

(we likely can upgrade those, but that will of course block this PR for us)

Copy link

Choose a reason for hiding this comment

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

Please consider either a) handling older versions also (which should be trivial), or b) create a release with an upper version for the pytest dep.

@mixja
Are you up for adjusting the PR, to still use get_marker if get_closest_marker is not available?

@MRigal
Copy link

MRigal commented Mar 29, 2019

I guess can be closed as addressed through #9

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.

5 participants