Skip to content

Commit 228729b

Browse files
committed
Fix lint and local tests
1 parent ae24c8b commit 228729b

File tree

3 files changed

+1
-42
lines changed

3 files changed

+1
-42
lines changed

test_elasticsearch/test_async/test_transport.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import asyncio
2020
import re
2121
import warnings
22-
from typing import Any, Dict, Optional, Union
22+
from typing import Any, Dict, Optional
2323

2424
import pytest
2525
from elastic_transport import (

test_elasticsearch/test_transport.py

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -525,10 +525,8 @@ def test_sniff_after_n_seconds(self):
525525
"kwargs",
526526
[
527527
{"sniff_on_start": True},
528-
{"sniff_on_connection_fail": True},
529528
{"sniff_on_node_failure": True},
530529
{"sniff_before_requests": True},
531-
{"sniffer_timeout": 1},
532530
{"sniff_timeout": 1},
533531
],
534532
)
@@ -589,41 +587,6 @@ def sniffed_node_callback(
589587
ports = {node.config.port for node in client.transport.node_pool.all()}
590588
assert ports == {9200, 124}
591589

592-
def test_sniffing_deprecated_host_info_callback(self):
593-
def host_info_callback(
594-
node_info: Dict[str, Any], host: Dict[str, Union[int, str]]
595-
) -> Dict[str, Any]:
596-
return (
597-
host if node_info["http"]["publish_address"].endswith(":124") else None
598-
)
599-
600-
with warnings.catch_warnings(record=True) as w:
601-
client = Elasticsearch( # noqa: F821
602-
[
603-
NodeConfig(
604-
"http",
605-
"localhost",
606-
9200,
607-
_extras={"data": CLUSTER_NODES_MASTER_ONLY},
608-
)
609-
],
610-
node_class=DummyNode,
611-
sniff_on_start=True,
612-
host_info_callback=host_info_callback,
613-
)
614-
615-
assert len(w) == 1
616-
assert w[0].category == DeprecationWarning
617-
assert (
618-
str(w[0].message)
619-
== "The 'host_info_callback' parameter is deprecated in favor of 'sniffed_node_callback'"
620-
)
621-
622-
assert len(client.transport.node_pool) == 2
623-
624-
ports = {node.config.port for node in client.transport.node_pool.all()}
625-
assert ports == {9200, 124}
626-
627590

628591
@pytest.mark.parametrize("headers", [{}, {"X-elastic-product": "BAD HEADER"}])
629592
def test_unsupported_product_error(headers):

test_elasticsearch/test_types/aliased_types.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@
3434
[{"host": "localhost", "port": 9443}],
3535
transport_class=Transport,
3636
sniff_on_start=True,
37-
sniffer_timeout=0.1,
3837
sniff_timeout=1,
39-
sniff_on_connection_fail=False,
4038
max_retries=1,
4139
retry_on_status={100, 400, 503},
4240
retry_on_timeout=True,
@@ -103,9 +101,7 @@ def reindex_types() -> None:
103101
es2 = AsyncElasticsearch(
104102
[{"host": "localhost", "port": 9443}],
105103
sniff_on_start=True,
106-
sniffer_timeout=0.1,
107104
sniff_timeout=1,
108-
sniff_on_connection_fail=False,
109105
max_retries=1,
110106
retry_on_status={100, 400, 503},
111107
retry_on_timeout=True,

0 commit comments

Comments
 (0)