我正在使用tavern
测试python flask应用程序。偶尔,我会遇到http连接错误,如:
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
af, socktype, proto, canonname, sa = res
sock = None
try:
sock = socket.socket(af, socktype, proto)
# If provided, set socket level options before connecting.
_set_socket_options(sock, socket_options)
if timeout is not socket._GLOBAL_DEFAULT_TIMEOUT:
sock.settimeout(timeout)
if source_address:
sock.bind(source_address)
> sock.connect(sa)
E **ConnectionRefusedError: [Errno 111] Connection refused**
一个可能的原因是连接超时,所以我想更改tavern
使用的http连接的超时。我无法从tavern
中找到用于更改此值的配置,但根据上面的源代码,似乎默认超时是从socket._GLOBAL_DEFAULT_TIMEOUT
读取的。如何从我的应用程序更改此值?我不直接调用这个由Tavern
框架调用的连接方法。有没有办法从我的应用程序端更新它?
我正在使用pytest
来运行测试,因此如果我可以在pytest
上设置一些内容来覆盖这个值,这也很好
目前没有回答
相关问题 更多 >
编程相关推荐