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

test_not_modified_releases_connection fails with requests 2.29.0 #297

Closed
mweinelt opened this issue May 12, 2023 · 1 comment
Closed

test_not_modified_releases_connection fails with requests 2.29.0 #297

mweinelt opened this issue May 12, 2023 · 1 comment

Comments

@mweinelt
Copy link

The test now fails due to psf/requests@26bea1e.

_________ TestReleaseConnection.test_not_modified_releases_connection __________

self = <test_etag.TestReleaseConnection object at 0x7fffe4440d90>
server = <cherrypy._cpserver.Server object at 0x7ffff5de7910>
url = 'http://127.0.0.1:40527/'

    def test_not_modified_releases_connection(self, server, url):
        sess = CacheControl(requests.Session())
        etag_url = urljoin(url, "/etag")
        sess.get(etag_url)
    
        resp = Mock(status=304, headers={})
    
        # This is how the urllib3 response is created in
        # requests.adapters
        response_mod = "requests.adapters.HTTPResponse.from_httplib"
    
>       with patch(response_mod, Mock(return_value=resp)):

tests/test_etag.py:151: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/nix/store/iv4k48zk6fqjq6qm00b9qfwflb9wsh12-python3.10-mock-4.0.3/lib/python3.10/site-packages/mock/mock.py:1398: in __enter__
    self.target = self.getter()
/nix/store/iv4k48zk6fqjq6qm00b9qfwflb9wsh12-python3.10-mock-4.0.3/lib/python3.10/site-packages/mock/mock.py:1573: in <lambda>
    getter = lambda: _importer(target)
/nix/store/iv4k48zk6fqjq6qm00b9qfwflb9wsh12-python3.10-mock-4.0.3/lib/python3.10/site-packages/mock/mock.py:1249: in _importer
    thing = _dot_lookup(thing, comp, import_path)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

thing = <module 'requests.adapters' from '/nix/store/27vh1wp127b0aw7k1yxq3bpvamx97zj6-python3.10-requests-2.29.0/lib/python3.10/site-packages/requests/adapters.py'>
comp = 'HTTPResponse', import_path = 'requests.adapters.HTTPResponse'

    def _dot_lookup(thing, comp, import_path):
        try:
            return getattr(thing, comp)
        except AttributeError:
>           __import__(import_path)
E           ModuleNotFoundError: No module named 'requests.adapters.HTTPResponse'; 'requests.adapters' is not a package

/nix/store/iv4k48zk6fqjq6qm00b9qfwflb9wsh12-python3.10-mock-4.0.3/lib/python3.10/site-packages/mock/mock.py:1238: ModuleNotFoundError
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

No branches or pull requests

2 participants