MCPcopy Index your code
hub / github.com/mitmproxy/mitmproxy / test_tcp_start_error

Function test_tcp_start_error

test/mitmproxy/proxy/test_mode_servers.py:294–312  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

292
293
294async def test_tcp_start_error():
295 manager = MagicMock()
296
297 server = await asyncio.start_server(
298 MagicMock(), host="127.0.0.1", port=0, reuse_address=False
299 )
300 port = server.sockets[0].getsockname()[1]
301
302 with taddons.context() as tctx:
303 inst = ServerInstance.make(f"regular@127.0.0.1:{port}", manager)
304 with pytest.raises(
305 OSError, match=f"proxy failed to listen on 127\\.0\\.0\\.1:{port}"
306 ):
307 await inst.start()
308 tctx.options.listen_host = "127.0.0.1"
309 tctx.options.listen_port = port
310 inst3 = ServerInstance.make(f"regular", manager)
311 with pytest.raises(OSError):
312 await inst3.start()
313
314
315async def test_invalid_protocol(monkeypatch):

Callers

nothing calls this directly

Calls 3

contextMethod · 0.80
makeMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…