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
httpretty.errors.UnmockedError: Failed to socket.setblocking because because a real socket does not exist #5016
Comments
Hi @AltafHussain4748, which version of Moto are you using? Can you also share an example test case that throws this error, and a full stacktrace? |
Closing this - there's not much we can do without something reproducible. |
Hi , I tested with this simple examples as following, sample_httpretty # sample_httpretty/get_something.py
import requests
class getSomething(object):
def get_something(self):
url = "https://httpbin.org/get"
r = requests.get(url)
return r # tests/test_something.py
import json
import unittest
import httpretty
from sample_httpretty.get_something import getSomething
class testGetSomething(unittest.TestCase):
def test_get_something(self):
res_test = {
"args": {},
"headers": {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate",
"Host": "httpbin.org",
"User-Agent": "python-requests/2.31.0",
"X-Amzn-Trace-Id": "Root=1-64cb067e-588612f81f427ba53bcc98a1",
},
"origin": "123.123.123.123",
"url": "https://httpbin.org/get",
}
httpretty.enable(allow_net_connect=False)
httpretty.register_uri(
httpretty.GET,
"https://httpbin.org/get",
body=json.dumps(res_test),
content_type="application/json",
)
res = getSomething().get_something()
print(res.text) ============================================================================================================================= FAILURES ============================================================================================================================== self = <tests.test_something.testGetSomething testMethod=test_get_something>
tests\test_something.py:30: sample_httpretty\get_something.py:8: in get_something self = httpretty.core.socket("proxy01.ad.local:8080"), request = None, address = ('proxy01.ad.local', 8080)
E httpretty.errors.UnmockedError: Failed to socket.connect() because because a real socket was never created. .venv\lib\site-packages\httpretty\core.py:645: UnmockedError |
This looks same as #122 |
I am using
moto
a python library to mock aws services. On my local everything works fine but on teamcity I get the errorI am usning
httpretty==1.1.4
with python3.8.The text was updated successfully, but these errors were encountered: