-
-
Notifications
You must be signed in to change notification settings - Fork 351
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
ResourceWarning from pytest with responses 0.24.0 #689
Comments
I think this might be related to #685 I will investigate later |
This issue most likely also is the cause of the test suite failing on pypy3 (we tested it for packaging responses-0.24.0 for Gentoo). It fails with resource exhaustion of open files. |
4 tasks
jamesclark-Zapata
added a commit
to zapata-engineering/orquestra-sdk
that referenced
this issue
Nov 6, 2023
# The problem New venvs install the latest version of `responses` which leaves a socket open causing a `ResourceWarning` which causes tests to fail. This is releated to getsentry/responses#689 # This PR's solution - Disallow `responses==0.24` in dependencies # Checklist _Check that this PR satisfies the following items:_ - [x] Tests have been added for new features/changed behavior (if no new features have been added, check the box). - [x] The [changelog file](CHANGELOG.md) has been updated with a user-readable description of the changes (if the change isn't visible to the user in any way, check the box). - [x] The PR's title is prefixed with `<feat/fix/chore/imp[rovement]/int[ernal]/docs>[!]:` - [x] The PR is linked to a JIRA ticket (if there's no suitable ticket, check the box).
We don't need – actually don't want – any kind of networking during our test battery execution. The following fixture is a workaround. import pytest
import unittest
@pytest.fixture(autouse=True)
def disable_builtin_socket(scope='session'):
with unittest.mock.patch('socket.socket'):
yield |
Merged
This was referenced Nov 14, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
Consider the following pytest test file:
This is accompanied by the following pytest configuration in
tox.ini
:Running
pytest
on the above test succeeds without a problem with responses 0.23.3, but if responses 0.24.0 is used, the test fails with:I suspect that the newer
responses
isn't closing a socket somewhere, possibly due to failure to use a context manager.Additional context
No response
Version of
responses
0.24.0
Steps to Reproduce
I just filled that out above.
Expected Result
No errors.
Actual Result
See errors above.
The text was updated successfully, but these errors were encountered: