instance_id stringclasses 28
values | test_id stringlengths 30 622 | affected bool 2
classes | text stringlengths 301 41.6M | license stringclasses 5
values |
|---|---|---|---|---|
aio-libs__aiohttp-9047 | tests/test_connector.py::test_release_close[pyloop] | true | async def test_release_close(loop, key) -> None:
conn = aiohttp.BaseConnector(loop=loop)
proto = mock.Mock(should_close=True)
conn._acquired.add(proto)
conn._release(key, proto)
assert not conn._conns
assert proto.close.called
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES/90... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_release_close_do_not_add_to_pool[pyloop] | true | async def test_release_close_do_not_add_to_pool(loop, key) -> None:
# see issue #473
conn = aiohttp.BaseConnector(loop=loop)
proto = mock.Mock(should_close=True)
conn._acquired.add(proto)
conn._release(key, proto)
assert not conn._conns
# --- pre-patch trace ---
# --- patch ---
diff --git a... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_release_close_do_not_delete_existing_connections | true | async def test_release_close_do_not_delete_existing_connections(key) -> None:
proto1 = mock.Mock()
conn = aiohttp.BaseConnector()
conn._conns[key] = [(proto1, 1)]
proto = mock.Mock(should_close=True)
conn._acquired.add(proto)
conn._release(key, proto)
assert conn._conns[key] == [(proto1, 1... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_release_not_opened[pyloop] | true | async def test_release_not_opened(loop, key) -> None:
conn = aiohttp.BaseConnector(loop=loop)
proto = mock.Mock()
conn._acquired.add(proto)
conn._release(key, proto)
assert proto.close.called
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES/9032.bugfix.rst b/CHANGES/9032.bugfix.rst... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_release_not_started[pyloop] | true | async def test_release_not_started(loop) -> None:
conn = aiohttp.BaseConnector(loop=loop)
proto = mock.Mock(should_close=False)
key = 1
conn._acquired.add(proto)
conn._release(key, proto)
# assert conn._conns == {1: [(proto, 10)]}
rec = conn._conns[1]
assert rec[0][0] == proto
assert... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_release_ssl_transport[pyloop] | true | async def test_release_ssl_transport(loop, ssl_key) -> None:
conn = aiohttp.BaseConnector(loop=loop, enable_cleanup_closed=True)
conn._release_waiter = mock.Mock()
proto = mock.Mock()
transport = proto.transport
conn._acquired.add(proto)
conn._acquired_per_host[ssl_key].add(proto)
conn._re... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_release_waiter_first_available[pyloop] | true | async def test_release_waiter_first_available(loop, key, key2) -> None:
conn = aiohttp.BaseConnector(loop=loop)
w1, w2 = mock.Mock(), mock.Mock()
w1.done.return_value = False
w2.done.return_value = False
conn._waiters[key].append(w2)
conn._waiters[key2].append(w1)
conn._release_waiter()
... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_release_waiter_no_available[pyloop] | true | async def test_release_waiter_no_available(loop, key, key2) -> None:
# limit is 0
conn = aiohttp.BaseConnector(limit=0, loop=loop)
w = mock.Mock()
w.done.return_value = False
conn._waiters[key].append(w)
conn._available_connections = mock.Mock(return_value=0)
conn._release_waiter()
asser... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_release_waiter_no_limit[pyloop] | true | async def test_release_waiter_no_limit(loop, key, key2) -> None:
# limit is 0
conn = aiohttp.BaseConnector(limit=0, loop=loop)
w = mock.Mock()
w.done.return_value = False
conn._waiters[key].append(w)
conn._release_waiter()
assert len(conn._waiters[key]) == 0
assert w.done.called
awai... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_release_waiter_per_host[pyloop] | true | async def test_release_waiter_per_host(loop, key, key2) -> None:
# no limit
conn = aiohttp.BaseConnector(loop=loop, limit=0, limit_per_host=2)
w1, w2 = mock.Mock(), mock.Mock()
w1.done.return_value = False
w2.done.return_value = False
conn._waiters[key] = deque([w1])
conn._waiters[key2] = de... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_release_waiter_release_first[pyloop] | true | async def test_release_waiter_release_first(loop, key, key2) -> None:
conn = aiohttp.BaseConnector(loop=loop, limit=1)
w1, w2 = mock.Mock(), mock.Mock()
w1.done.return_value = False
w2.done.return_value = False
conn._waiters[key] = deque([w1, w2])
conn._release_waiter()
assert w1.set_result.... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_release_waiter_skip_done_waiter[pyloop] | true | async def test_release_waiter_skip_done_waiter(loop, key, key2) -> None:
conn = aiohttp.BaseConnector(loop=loop, limit=1)
w1, w2 = mock.Mock(), mock.Mock()
w1.done.return_value = True
w2.done.return_value = False
conn._waiters[key] = deque([w1, w2])
conn._release_waiter()
assert not w1.set_r... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_resolver_not_called_with_address_is_ip[pyloop] | true | async def test_resolver_not_called_with_address_is_ip(loop) -> None:
resolver = mock.MagicMock()
connector = aiohttp.TCPConnector(resolver=resolver)
req = ClientRequest(
"GET",
URL(f"http://127.0.0.1:{unused_port()}"),
loop=loop,
response_class=mock.Mock(),
)
with p... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_ssl_context_once | true | async def test_ssl_context_once() -> None:
"""Test the ssl context is created only once and shared between connectors."""
conn1 = aiohttp.TCPConnector()
conn2 = aiohttp.TCPConnector()
conn3 = aiohttp.TCPConnector()
req = mock.Mock()
req.is_ssl.return_value = True
req.ssl = True
assert c... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_ssl_none | true | async def test_ssl_none() -> None:
conn = aiohttp.TCPConnector(ssl=None)
assert conn._ssl is True
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES/9032.bugfix.rst b/CHANGES/9032.bugfix.rst
new file mode 100644
index 000000000..8c8d81f63
--- /dev/null
+++ b/CHANGES/9032.bugfix.rst
@@ -0,0 +1,3 @... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_tcp_connector[pyloop] | true | async def test_tcp_connector(aiohttp_client, loop) -> None:
async def handler(request):
return web.Response()
app = web.Application()
app.router.add_get("/", handler)
client = await aiohttp_client(app)
r = await client.get("/")
assert r.status == 200
# --- pre-patch trace ---
# --- ... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_tcp_connector_allowed_protocols[pyloop] | true | async def test_tcp_connector_allowed_protocols(loop: asyncio.AbstractEventLoop) -> None:
conn = aiohttp.TCPConnector()
assert conn.allowed_protocol_schema_set == {"", "tcp", "http", "https", "ws", "wss"}
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES/9032.bugfix.rst b/CHANGES/9032.bugfix.rst
... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_tcp_connector_cancel_dns_error_captured[pyloop] | true | async def test_tcp_connector_cancel_dns_error_captured(
loop, dns_response_error
) -> None:
exception_handler_called = False
def exception_handler(loop, context):
nonlocal exception_handler_called
exception_handler_called = True
loop.set_exception_handler(mock.Mock(side_effect=excepti... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_tcp_connector_certificate_error[pyloop] | true | async def test_tcp_connector_certificate_error(
loop: Any, start_connection: mock.AsyncMock
) -> None:
req = ClientRequest("GET", URL("https://127.0.0.1:443"), loop=loop)
async def certificate_error(*args, **kwargs):
raise ssl.CertificateError
conn = aiohttp.TCPConnector(loop=loop)
conn._l... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_tcp_connector_clear_dns_cache[pyloop] | true | async def test_tcp_connector_clear_dns_cache(loop) -> None:
conn = aiohttp.TCPConnector(loop=loop)
hosts = ["a", "b"]
conn._cached_hosts.add(("localhost", 123), hosts)
conn._cached_hosts.add(("localhost", 124), hosts)
conn.clear_dns_cache("localhost", 123)
with pytest.raises(KeyError):
c... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_tcp_connector_clear_dns_cache_bad_args[pyloop] | true | async def test_tcp_connector_clear_dns_cache_bad_args(loop) -> None:
conn = aiohttp.TCPConnector(loop=loop)
with pytest.raises(ValueError):
conn.clear_dns_cache("localhost")
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES/9032.bugfix.rst b/CHANGES/9032.bugfix.rst
new file mode 100644
i... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_tcp_connector_ctor | true | async def test_tcp_connector_ctor() -> None:
conn = aiohttp.TCPConnector()
assert conn._ssl is True
assert conn.use_dns_cache
assert conn.family == 0
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES/9032.bugfix.rst b/CHANGES/9032.bugfix.rst
new file mode 100644
index 000000000..8c8d81f... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_tcp_connector_ctor_fingerprint_valid[pyloop] | true | async def test_tcp_connector_ctor_fingerprint_valid(
loop: asyncio.AbstractEventLoop,
) -> None:
valid = aiohttp.Fingerprint(hashlib.sha256(b"foo").digest())
conn = aiohttp.TCPConnector(ssl=valid, loop=loop)
assert conn._ssl is valid
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES/9032... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_tcp_connector_dns_cache_forever[pyloop] | true | async def test_tcp_connector_dns_cache_forever(loop, dns_response) -> None:
with mock.patch("aiohttp.connector.DefaultResolver") as m_resolver:
conn = aiohttp.TCPConnector(loop=loop, use_dns_cache=True, ttl_dns_cache=10)
m_resolver().resolve.return_value = dns_response()
await conn._resolve_... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_tcp_connector_dns_cache_not_expired[pyloop] | true | async def test_tcp_connector_dns_cache_not_expired(loop, dns_response) -> None:
with mock.patch("aiohttp.connector.DefaultResolver") as m_resolver:
conn = aiohttp.TCPConnector(loop=loop, use_dns_cache=True, ttl_dns_cache=10)
m_resolver().resolve.return_value = dns_response()
await conn._reso... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_tcp_connector_dns_throttle_requests[pyloop] | true | async def test_tcp_connector_dns_throttle_requests(loop, dns_response) -> None:
with mock.patch("aiohttp.connector.DefaultResolver") as m_resolver:
conn = aiohttp.TCPConnector(loop=loop, use_dns_cache=True, ttl_dns_cache=10)
m_resolver().resolve.return_value = dns_response()
loop.create_task... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_tcp_connector_dns_throttle_requests_cancelled_when_close[pyloop] | true | async def test_tcp_connector_dns_throttle_requests_cancelled_when_close(
loop, dns_response
):
with mock.patch("aiohttp.connector.DefaultResolver") as m_resolver:
conn = aiohttp.TCPConnector(loop=loop, use_dns_cache=True, ttl_dns_cache=10)
m_resolver().resolve.return_value = dns_response()
... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_tcp_connector_dns_throttle_requests_exception_spread[pyloop] | true | async def test_tcp_connector_dns_throttle_requests_exception_spread(loop) -> None:
with mock.patch("aiohttp.connector.DefaultResolver") as m_resolver:
conn = aiohttp.TCPConnector(loop=loop, use_dns_cache=True, ttl_dns_cache=10)
e = Exception()
m_resolver().resolve.side_effect = e
r1 ... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_tcp_connector_dns_tracing[pyloop] | true | async def test_tcp_connector_dns_tracing(loop, dns_response) -> None:
session = mock.Mock()
trace_config_ctx = mock.Mock()
on_dns_resolvehost_start = mock.Mock(side_effect=make_mocked_coro(mock.Mock()))
on_dns_resolvehost_end = mock.Mock(side_effect=make_mocked_coro(mock.Mock()))
on_dns_cache_hit = ... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_tcp_connector_dns_tracing_cache_disabled[pyloop] | true | async def test_tcp_connector_dns_tracing_cache_disabled(loop, dns_response) -> None:
session = mock.Mock()
trace_config_ctx = mock.Mock()
on_dns_resolvehost_start = mock.Mock(side_effect=make_mocked_coro(mock.Mock()))
on_dns_resolvehost_end = mock.Mock(side_effect=make_mocked_coro(mock.Mock()))
tra... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_tcp_connector_dns_tracing_throttle_requests[pyloop] | true | async def test_tcp_connector_dns_tracing_throttle_requests(loop, dns_response) -> None:
session = mock.Mock()
trace_config_ctx = mock.Mock()
on_dns_cache_hit = mock.Mock(side_effect=make_mocked_coro(mock.Mock()))
on_dns_cache_miss = mock.Mock(side_effect=make_mocked_coro(mock.Mock()))
trace_config ... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_tcp_connector_do_not_raise_connector_ssl_error[pyloop-domain name] | true | @pytest.mark.parametrize(
"host",
(
pytest.param("127.0.0.1", id="ip address"),
pytest.param("localhost", id="domain name"),
pytest.param("localhost.", id="fully-qualified domain name"),
pytest.param(
"localhost...", id="fully-qualified domain name with multiple trail... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_tcp_connector_do_not_raise_connector_ssl_error[pyloop-fully-qualified domain name with multiple trailing dots] | true | @pytest.mark.parametrize(
"host",
(
pytest.param("127.0.0.1", id="ip address"),
pytest.param("localhost", id="domain name"),
pytest.param("localhost.", id="fully-qualified domain name"),
pytest.param(
"localhost...", id="fully-qualified domain name with multiple trail... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_tcp_connector_do_not_raise_connector_ssl_error[pyloop-fully-qualified domain name] | true | @pytest.mark.parametrize(
"host",
(
pytest.param("127.0.0.1", id="ip address"),
pytest.param("localhost", id="domain name"),
pytest.param("localhost.", id="fully-qualified domain name"),
pytest.param(
"localhost...", id="fully-qualified domain name with multiple trail... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_tcp_connector_do_not_raise_connector_ssl_error[pyloop-idna fully-qualified domain name] | true | @pytest.mark.parametrize(
"host",
(
pytest.param("127.0.0.1", id="ip address"),
pytest.param("localhost", id="domain name"),
pytest.param("localhost.", id="fully-qualified domain name"),
pytest.param(
"localhost...", id="fully-qualified domain name with multiple trail... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_tcp_connector_do_not_raise_connector_ssl_error[pyloop-ip address] | true | @pytest.mark.parametrize(
"host",
(
pytest.param("127.0.0.1", id="ip address"),
pytest.param("localhost", id="domain name"),
pytest.param("localhost.", id="fully-qualified domain name"),
pytest.param(
"localhost...", id="fully-qualified domain name with multiple trail... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_tcp_connector_family_is_respected[pyloop] | true | async def test_tcp_connector_family_is_respected(loop: Any) -> None:
conn = aiohttp.TCPConnector(family=socket.AF_INET)
ip1 = "dead::beef::"
ip2 = "192.168.1.1"
ips = [ip1, ip2]
addrs_tried = []
req = ClientRequest(
"GET",
URL("https://mocked.host"),
loop=loop,
)
... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_tcp_connector_happy_eyeballs[pyloop-0.1] | true | @pytest.mark.parametrize(
("happy_eyeballs_delay"),
[0.1, 0.25, None],
)
async def test_tcp_connector_happy_eyeballs(
loop: Any, happy_eyeballs_delay: Optional[float]
) -> None:
conn = aiohttp.TCPConnector(happy_eyeballs_delay=happy_eyeballs_delay)
ip1 = "dead::beef::"
ip2 = "192.168.1.1"
i... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_tcp_connector_happy_eyeballs[pyloop-0.25] | true | @pytest.mark.parametrize(
("happy_eyeballs_delay"),
[0.1, 0.25, None],
)
async def test_tcp_connector_happy_eyeballs(
loop: Any, happy_eyeballs_delay: Optional[float]
) -> None:
conn = aiohttp.TCPConnector(happy_eyeballs_delay=happy_eyeballs_delay)
ip1 = "dead::beef::"
ip2 = "192.168.1.1"
i... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_tcp_connector_happy_eyeballs[pyloop-None] | true | @pytest.mark.parametrize(
("happy_eyeballs_delay"),
[0.1, 0.25, None],
)
async def test_tcp_connector_happy_eyeballs(
loop: Any, happy_eyeballs_delay: Optional[float]
) -> None:
conn = aiohttp.TCPConnector(happy_eyeballs_delay=happy_eyeballs_delay)
ip1 = "dead::beef::"
ip2 = "192.168.1.1"
i... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_tcp_connector_interleave[pyloop] | true | async def test_tcp_connector_interleave(loop: Any) -> None:
conn = aiohttp.TCPConnector(interleave=2)
ip1 = "192.168.1.1"
ip2 = "192.168.1.2"
ip3 = "dead::beef::"
ip4 = "aaaa::beef::"
ip5 = "192.168.1.5"
ips = [ip1, ip2, ip3, ip4, ip5]
success_ips = []
interleave = None
req = C... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_tcp_connector_multiple_hosts_errors[pyloop] | true | async def test_tcp_connector_multiple_hosts_errors(loop) -> None:
conn = aiohttp.TCPConnector(loop=loop)
ip1 = "192.168.1.1"
ip2 = "192.168.1.2"
ip3 = "192.168.1.3"
ip4 = "192.168.1.4"
ip5 = "192.168.1.5"
ips = [ip1, ip2, ip3, ip4, ip5]
addrs_tried = []
ips_tried = []
fingerpri... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_tcp_connector_raise_connector_ssl_error[pyloop] | true | async def test_tcp_connector_raise_connector_ssl_error(
aiohttp_server,
ssl_ctx,
) -> None:
async def handler(request):
return web.Response()
app = web.Application()
app.router.add_get("/", handler)
srv = await aiohttp_server(app, ssl=ssl_ctx)
port = unused_port()
conn = aioht... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_tcp_connector_resolve_host[pyloop] | true | async def test_tcp_connector_resolve_host(loop: Any) -> None:
conn = aiohttp.TCPConnector(use_dns_cache=True)
res = await conn._resolve_host("localhost", 8080)
assert res
for rec in res:
if rec["family"] == socket.AF_INET:
assert rec["host"] == "127.0.0.1"
assert rec["ho... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_tcp_connector_server_hostname_default[pyloop] | true | async def test_tcp_connector_server_hostname_default(
loop: Any, start_connection: mock.AsyncMock
) -> None:
conn = aiohttp.TCPConnector()
with mock.patch.object(
conn._loop, "create_connection", autospec=True, spec_set=True
) as create_connection:
create_connection.return_value = mock.... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_tcp_connector_server_hostname_override[pyloop] | true | async def test_tcp_connector_server_hostname_override(
loop: Any, start_connection: mock.AsyncMock
) -> None:
conn = aiohttp.TCPConnector()
with mock.patch.object(
conn._loop, "create_connection", autospec=True, spec_set=True
) as create_connection:
create_connection.return_value = mock... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_tcp_connector_use_dns_cache_disabled[pyloop] | true | async def test_tcp_connector_use_dns_cache_disabled(loop, dns_response) -> None:
with mock.patch("aiohttp.connector.DefaultResolver") as m_resolver:
conn = aiohttp.TCPConnector(loop=loop, use_dns_cache=False)
m_resolver().resolve.side_effect = [dns_response(), dns_response()]
await conn._res... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_tcp_connector_uses_provided_local_addr[pyloop] | true | async def test_tcp_connector_uses_provided_local_addr(aiohttp_server) -> None:
async def handler(request):
return web.Response()
app = web.Application()
app.router.add_get("/", handler)
srv = await aiohttp_server(app)
port = unused_port()
conn = aiohttp.TCPConnector(local_addr=("127.0.... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_unix_connector[pyloop] | true | async def test_unix_connector(unix_server, unix_sockname) -> None:
async def handler(request):
return web.Response()
app = web.Application()
app.router.add_get("/", handler)
await unix_server(app)
url = "http://127.0.0.1/"
connector = aiohttp.UnixConnector(unix_sockname)
assert un... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_unix_connector_not_found[pyloop] | true | @pytest.mark.skipif(not hasattr(socket, "AF_UNIX"), reason="requires UNIX sockets")
async def test_unix_connector_not_found(loop) -> None:
connector = aiohttp.UnixConnector("/" + uuid.uuid4().hex)
req = ClientRequest("GET", URL("http://www.python.org"), loop=loop)
with pytest.raises(aiohttp.ClientConnector... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_unix_connector_permission[pyloop] | true | @pytest.mark.skipif(not hasattr(socket, "AF_UNIX"), reason="requires UNIX sockets")
async def test_unix_connector_permission(loop) -> None:
loop.create_unix_connection = make_mocked_coro(raise_exception=PermissionError())
connector = aiohttp.UnixConnector("/" + uuid.uuid4().hex, loop=loop)
req = ClientRequ... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_proxy.py::TestProxy::test_connect | true | @mock.patch("aiohttp.connector.ClientRequest")
@mock.patch(
"aiohttp.connector.aiohappyeyeballs.start_connection",
autospec=True,
spec_set=True,
)
def test_connect(self, start_connection: Any, ClientRequestMock: Any) -> None:
req = ClientRequest(
"GET",
... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_proxy.py::TestProxy::test_https_auth | true | @mock.patch("aiohttp.connector.ClientRequest")
@mock.patch(
"aiohttp.connector.aiohappyeyeballs.start_connection",
autospec=True,
spec_set=True,
)
def test_https_auth(self, start_connection: Any, ClientRequestMock: Any) -> None:
proxy_req = ClientRequest(
"GET... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_proxy.py::TestProxy::test_https_connect | true | @mock.patch("aiohttp.connector.ClientRequest")
@mock.patch(
"aiohttp.connector.aiohappyeyeballs.start_connection",
autospec=True,
spec_set=True,
)
def test_https_connect(self, start_connection: Any, ClientRequestMock: Any) -> None:
proxy_req = ClientRequest(
"... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_proxy.py::TestProxy::test_https_connect_certificate_error | true | @mock.patch("aiohttp.connector.ClientRequest")
@mock.patch(
"aiohttp.connector.aiohappyeyeballs.start_connection",
autospec=True,
spec_set=True,
)
def test_https_connect_certificate_error(
self, start_connection: Any, ClientRequestMock: Any
) -> None:
proxy_re... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_proxy.py::TestProxy::test_https_connect_http_proxy_error | true | @mock.patch("aiohttp.connector.ClientRequest")
@mock.patch(
"aiohttp.connector.aiohappyeyeballs.start_connection",
autospec=True,
spec_set=True,
)
def test_https_connect_http_proxy_error(
self, start_connection: Any, ClientRequestMock: Any
) -> None:
proxy_req... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_proxy.py::TestProxy::test_https_connect_pass_ssl_context | true | @mock.patch("aiohttp.connector.ClientRequest")
@mock.patch(
"aiohttp.connector.aiohappyeyeballs.start_connection",
autospec=True,
spec_set=True,
)
def test_https_connect_pass_ssl_context(
self, start_connection: Any, ClientRequestMock: Any
) -> None:
proxy_req... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_proxy.py::TestProxy::test_https_connect_resp_start_error | true | @mock.patch("aiohttp.connector.ClientRequest")
@mock.patch(
"aiohttp.connector.aiohappyeyeballs.start_connection",
autospec=True,
spec_set=True,
)
def test_https_connect_resp_start_error(
self, start_connection: Any, ClientRequestMock: Any
) -> None:
proxy_req... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_proxy.py::TestProxy::test_https_connect_ssl_error | true | @mock.patch("aiohttp.connector.ClientRequest")
@mock.patch(
"aiohttp.connector.aiohappyeyeballs.start_connection",
autospec=True,
spec_set=True,
)
def test_https_connect_ssl_error(
self, start_connection: Any, ClientRequestMock: Any
) -> None:
proxy_req = Clie... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_proxy.py::TestProxy::test_proxy_auth | true | @mock.patch(
"aiohttp.connector.aiohappyeyeballs.start_connection",
autospec=True,
spec_set=True,
)
def test_proxy_auth(self, start_connection: Any) -> None:
with self.assertRaises(ValueError) as ctx:
ClientRequest(
"GET",
URL("http... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_proxy.py::TestProxy::test_proxy_auth_property | true | def test_proxy_auth_property(self) -> None:
req = aiohttp.ClientRequest(
"GET",
URL("http://localhost:1234/path"),
proxy=URL("http://proxy.example.com"),
proxy_auth=aiohttp.helpers.BasicAuth("user", "pass"),
loop=self.loop,
)
self.a... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_proxy.py::TestProxy::test_proxy_auth_property_default | true | def test_proxy_auth_property_default(self) -> None:
req = aiohttp.ClientRequest(
"GET",
URL("http://localhost:1234/path"),
proxy=URL("http://proxy.example.com"),
loop=self.loop,
)
self.assertIsNone(req.proxy_auth)
# --- pre-patch trace ---
#... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_proxy.py::TestProxy::test_proxy_connection_error | true | @mock.patch(
"aiohttp.connector.aiohappyeyeballs.start_connection",
autospec=True,
spec_set=True,
)
def test_proxy_connection_error(self, start_connection: Any) -> None:
async def make_conn():
return aiohttp.TCPConnector()
connector = self.loop.run_until_... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_proxy.py::TestProxy::test_proxy_dns_error | true | @mock.patch(
"aiohttp.connector.aiohappyeyeballs.start_connection",
autospec=True,
spec_set=True,
)
def test_proxy_dns_error(self, start_connection: Any) -> None:
async def make_conn():
return aiohttp.TCPConnector()
connector: aiohttp.TCPConnector = self.... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_proxy.py::TestProxy::test_proxy_headers | true | @mock.patch("aiohttp.connector.ClientRequest")
@mock.patch(
"aiohttp.connector.aiohappyeyeballs.start_connection",
autospec=True,
spec_set=True,
)
def test_proxy_headers(self, start_connection: Any, ClientRequestMock: Any) -> None:
req = ClientRequest(
"GET",
... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_proxy.py::TestProxy::test_proxy_server_hostname_default | true | @mock.patch("aiohttp.connector.ClientRequest")
@mock.patch(
"aiohttp.connector.aiohappyeyeballs.start_connection",
autospec=True,
spec_set=True,
)
def test_proxy_server_hostname_default(
self, start_connection: Any, ClientRequestMock: Any
) -> None:
proxy_req ... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_proxy.py::TestProxy::test_proxy_server_hostname_override | true | @mock.patch("aiohttp.connector.ClientRequest")
@mock.patch(
"aiohttp.connector.aiohappyeyeballs.start_connection",
autospec=True,
spec_set=True,
)
def test_proxy_server_hostname_override(
self, start_connection: Any, ClientRequestMock: Any
) -> None:
proxy_req... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_proxy.py::TestProxy::test_request_port | true | @mock.patch("aiohttp.connector.ClientRequest")
@mock.patch(
"aiohttp.connector.aiohappyeyeballs.start_connection",
autospec=True,
spec_set=True,
)
def test_request_port(self, start_connection: Any, ClientRequestMock: Any) -> None:
proxy_req = ClientRequest(
"G... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_resolver.py::test_aio_dns_is_default | true | @pytest.mark.skipif(not getaddrinfo, reason="aiodns >=3.2.0 required")
def test_aio_dns_is_default() -> None:
assert DefaultResolver is AsyncResolver
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES/9032.bugfix.rst b/CHANGES/9032.bugfix.rst
new file mode 100644
index 000000000..8c8d81f63
--- /dev/n... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_resolver.py::test_async_resolver_aiodns_not_present[pyloop] | true | async def test_async_resolver_aiodns_not_present(loop, monkeypatch) -> None:
monkeypatch.setattr("aiohttp.resolver.aiodns", None)
with pytest.raises(RuntimeError):
AsyncResolver(loop=loop)
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES/9032.bugfix.rst b/CHANGES/9032.bugfix.rst
new fil... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_resolver.py::test_async_resolver_ipv6_positive_lookup[pyloop] | true | @pytest.mark.skipif(not getaddrinfo, reason="aiodns >=3.2.0 required")
async def test_async_resolver_ipv6_positive_lookup(loop: Any) -> None:
with patch("aiodns.DNSResolver") as mock:
mock().getaddrinfo.return_value = fake_aiodns_getaddrinfo_ipv6_result(["::1"])
resolver = AsyncResolver()
re... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_resolver.py::test_async_resolver_multiple_replies[pyloop] | true | @pytest.mark.skipif(not getaddrinfo, reason="aiodns >=3.2.0 required")
async def test_async_resolver_multiple_replies(loop: Any) -> None:
with patch("aiodns.DNSResolver") as mock:
ips = ["127.0.0.1", "127.0.0.2", "127.0.0.3", "127.0.0.4"]
mock().getaddrinfo.return_value = fake_aiodns_getaddrinfo_ipv... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_resolver.py::test_async_resolver_negative_lookup[pyloop] | true | @pytest.mark.skipif(not getaddrinfo, reason="aiodns >=3.2.0 required")
async def test_async_resolver_negative_lookup(loop: Any) -> None:
with patch("aiodns.DNSResolver") as mock:
mock().getaddrinfo.side_effect = aiodns.error.DNSError()
resolver = AsyncResolver()
with pytest.raises(OSError):
... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_resolver.py::test_async_resolver_no_hosts_in_getaddrinfo[pyloop] | true | @pytest.mark.skipif(not getaddrinfo, reason="aiodns >=3.2.0 required")
async def test_async_resolver_no_hosts_in_getaddrinfo(loop: Any) -> None:
with patch("aiodns.DNSResolver") as mock:
mock().getaddrinfo.return_value = fake_aiodns_getaddrinfo_ipv4_result([])
resolver = AsyncResolver()
with... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_resolver.py::test_async_resolver_positive_ipv4_lookup[pyloop] | true | @pytest.mark.skipif(not getaddrinfo, reason="aiodns >=3.2.0 required")
async def test_async_resolver_positive_ipv4_lookup(loop: Any) -> None:
with patch("aiodns.DNSResolver") as mock:
mock().getaddrinfo.return_value = fake_aiodns_getaddrinfo_ipv4_result(
["127.0.0.1"]
)
resolver ... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_resolver.py::test_async_resolver_positive_link_local_ipv6_lookup[pyloop] | true | @pytest.mark.skipif(not getaddrinfo, reason="aiodns >=3.2.0 required")
async def test_async_resolver_positive_link_local_ipv6_lookup(loop: Any) -> None:
with patch("aiodns.DNSResolver") as mock:
mock().getaddrinfo.return_value = fake_aiodns_getaddrinfo_ipv6_result(
["fe80::1"]
)
... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_resolver.py::test_async_resolver_query_ipv6_positive_lookup[pyloop] | true | @pytest.mark.skipif(aiodns is None, reason="aiodns required")
async def test_async_resolver_query_ipv6_positive_lookup(loop) -> None:
with patch("aiodns.DNSResolver") as mock:
del mock().gethostbyname
mock().query.return_value = fake_query_result(["::1"])
resolver = AsyncResolver(loop=loop)
... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_resolver.py::test_async_resolver_query_multiple_replies[pyloop] | true | @pytest.mark.skipif(aiodns is None, reason="aiodns required")
async def test_async_resolver_query_multiple_replies(loop) -> None:
with patch("aiodns.DNSResolver") as mock:
del mock().gethostbyname
ips = ["127.0.0.1", "127.0.0.2", "127.0.0.3", "127.0.0.4"]
mock().query.return_value = fake_que... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_resolver.py::test_close_for_async_resolver[pyloop] | true | @pytest.mark.skipif(aiodns is None, reason="aiodns required")
async def test_close_for_async_resolver(loop) -> None:
resolver = AsyncResolver(loop=loop)
await resolver.close()
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES/9032.bugfix.rst b/CHANGES/9032.bugfix.rst
new file mode 100644
index 0... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_resolver.py::test_close_for_threaded_resolver[pyloop] | true | async def test_close_for_threaded_resolver(loop) -> None:
resolver = ThreadedResolver()
await resolver.close()
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES/9032.bugfix.rst b/CHANGES/9032.bugfix.rst
new file mode 100644
index 000000000..8c8d81f63
--- /dev/null
+++ b/CHANGES/9032.bugfix.rst
@... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_resolver.py::test_default_loop_for_threaded_resolver[pyloop] | true | async def test_default_loop_for_threaded_resolver(loop) -> None:
asyncio.set_event_loop(loop)
resolver = ThreadedResolver()
assert resolver._loop is loop
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES/9032.bugfix.rst b/CHANGES/9032.bugfix.rst
new file mode 100644
index 000000000..8c8d81f6... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_resolver.py::test_threaded_negative_ipv6_lookup | true | async def test_threaded_negative_ipv6_lookup() -> None:
loop = Mock()
ips: List[Any] = []
loop.getaddrinfo = fake_ipv6_addrinfo(ips)
resolver = ThreadedResolver()
resolver._loop = loop
with pytest.raises(socket.gaierror):
await resolver.resolve("doesnotexist.bla")
# --- pre-patch trace ... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_resolver.py::test_threaded_negative_lookup | true | async def test_threaded_negative_lookup() -> None:
loop = Mock()
ips = []
loop.getaddrinfo = fake_addrinfo(ips)
resolver = ThreadedResolver(loop=loop)
with pytest.raises(socket.gaierror):
await resolver.resolve("doesnotexist.bla")
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHA... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_resolver.py::test_threaded_negative_lookup_with_unknown_result | true | async def test_threaded_negative_lookup_with_unknown_result() -> None:
loop = Mock()
# If compile CPython with `--disable-ipv6` option,
# we will get an (int, bytes) tuple, instead of a Exception.
async def unknown_addrinfo(*args: Any, **kwargs: Any) -> List[Any]:
return [
(
... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_resolver.py::test_threaded_resolver_multiple_replies | true | async def test_threaded_resolver_multiple_replies() -> None:
loop = Mock()
ips = ["127.0.0.1", "127.0.0.2", "127.0.0.3", "127.0.0.4"]
loop.getaddrinfo = fake_addrinfo(ips)
resolver = ThreadedResolver(loop=loop)
real = await resolver.resolve("www.google.com")
ips = [ipaddress.ip_address(x["host"]... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_resolver.py::test_threaded_resolver_positive_ipv6_link_local_lookup | true | async def test_threaded_resolver_positive_ipv6_link_local_lookup() -> None:
loop = Mock()
loop.getaddrinfo = fake_ipv6_addrinfo(["fe80::1"])
loop.getnameinfo = fake_ipv6_nameinfo("fe80::1%eth0")
# Mock the fake function that was returned by helper functions
loop.getaddrinfo = create_autospec(loop.g... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_resolver.py::test_threaded_resolver_positive_lookup | true | async def test_threaded_resolver_positive_lookup() -> None:
loop = Mock()
loop.getaddrinfo = fake_addrinfo(["127.0.0.1"])
resolver = ThreadedResolver(loop=loop)
real = await resolver.resolve("www.python.org")
assert real[0]["hostname"] == "www.python.org"
ipaddress.ip_address(real[0]["host"])
#... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_base_protocol.py::test_connection_lost_not_paused | false | async def test_connection_lost_not_paused() -> None:
loop = asyncio.get_event_loop()
pr = BaseProtocol(loop=loop)
tr = mock.Mock()
pr.connection_made(tr)
assert pr.connected
pr.connection_lost(None)
assert pr.transport is None
assert not pr.connected
# --- trace ---
# === tests/test_bas... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_base_protocol.py::test_connection_lost_paused_without_waiter | false | async def test_connection_lost_paused_without_waiter() -> None:
loop = asyncio.get_event_loop()
pr = BaseProtocol(loop=loop)
tr = mock.Mock()
pr.connection_made(tr)
assert pr.connected
pr.pause_writing()
pr.connection_lost(None)
assert pr.transport is None
assert not pr.connected
# ... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_base_protocol.py::test_connection_lost_waiter_done | false | async def test_connection_lost_waiter_done() -> None:
loop = asyncio.get_event_loop()
pr = BaseProtocol(loop=loop)
pr._paused = True
waiter = mock.Mock(done=mock.Mock(return_value=True))
pr._drain_waiter = waiter
pr.connection_lost(None)
assert pr._drain_waiter is None
assert waiter.mock... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_base_protocol.py::test_connection_made | false | async def test_connection_made() -> None:
loop = asyncio.get_event_loop()
pr = BaseProtocol(loop=loop)
tr = mock.Mock()
assert pr.transport is None
pr.connection_made(tr)
assert pr.transport is not None
# --- trace ---
# === tests/test_base_protocol.py::test_connection_made (line 81) ===
async ... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_base_protocol.py::test_drain_lost | false | async def test_drain_lost() -> None:
loop = asyncio.get_event_loop()
pr = BaseProtocol(loop=loop)
tr = mock.Mock()
pr.connection_made(tr)
pr.connection_lost(None)
with pytest.raises(ConnectionResetError):
await pr._drain_helper()
# --- trace ---
# === tests/test_base_protocol.py::test_d... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_base_protocol.py::test_drain_not_paused | false | async def test_drain_not_paused() -> None:
loop = asyncio.get_event_loop()
pr = BaseProtocol(loop=loop)
tr = mock.Mock()
pr.connection_made(tr)
assert pr._drain_waiter is None
await pr._drain_helper()
assert pr._drain_waiter is None
# --- trace ---
# === tests/test_base_protocol.py::test_dr... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_base_protocol.py::test_loop | false | async def test_loop() -> None:
loop = asyncio.get_event_loop()
asyncio.set_event_loop(None)
pr = BaseProtocol(loop)
assert pr._loop is loop
# --- trace ---
# === tests/test_base_protocol.py::test_loop (line 10) ===
async def test_loop() -> None:
loop = asyncio.get_event_loop() # loop=<_UnixSelecto... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_base_protocol.py::test_lost_drain_cancelled | false | async def test_lost_drain_cancelled() -> None:
loop = asyncio.get_event_loop()
pr = BaseProtocol(loop=loop)
tr = mock.Mock()
pr.connection_made(tr)
pr.pause_writing()
fut = loop.create_future()
async def wait():
fut.set_result(None)
await pr._drain_helper()
t = loop.cr... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_base_protocol.py::test_lost_drain_waited_exception | false | async def test_lost_drain_waited_exception() -> None:
loop = asyncio.get_event_loop()
pr = BaseProtocol(loop=loop)
tr = mock.Mock()
pr.connection_made(tr)
pr.pause_writing()
t = loop.create_task(pr._drain_helper())
await asyncio.sleep(0)
assert pr._drain_waiter is not None
exc = Ru... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_base_protocol.py::test_lost_drain_waited_ok | false | async def test_lost_drain_waited_ok() -> None:
loop = asyncio.get_event_loop()
pr = BaseProtocol(loop=loop)
tr = mock.Mock()
pr.connection_made(tr)
pr.pause_writing()
t = loop.create_task(pr._drain_helper())
await asyncio.sleep(0)
assert pr._drain_waiter is not None
pr.connection_l... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_base_protocol.py::test_parallel_drain_race_condition | false | async def test_parallel_drain_race_condition() -> None:
loop = asyncio.get_event_loop()
pr = BaseProtocol(loop=loop)
tr = mock.Mock()
pr.connection_made(tr)
pr.pause_writing()
ts = [loop.create_task(pr._drain_helper()) for _ in range(5)]
assert not (await asyncio.wait(ts, timeout=0.5))[
... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_base_protocol.py::test_pause_reading_no_transport | false | async def test_pause_reading_no_transport() -> None:
loop = asyncio.get_event_loop()
pr = BaseProtocol(loop)
assert not pr._reading_paused
pr.pause_reading()
assert not pr._reading_paused
# --- trace ---
# === tests/test_base_protocol.py::test_pause_reading_no_transport (line 25) ===
async def test... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_base_protocol.py::test_pause_reading_stub_transport | false | async def test_pause_reading_stub_transport() -> None:
loop = asyncio.get_event_loop()
pr = BaseProtocol(loop)
tr = asyncio.Transport()
pr.transport = tr
assert not pr._reading_paused
pr.pause_reading()
assert pr._reading_paused
# --- trace ---
# === tests/test_base_protocol.py::test_pause_... | custom-check-github |