Skip to content

Commit 9afbea1

Browse files
authored
Fix deprecation warnings (#1663)
1 parent 9849502 commit 9afbea1

File tree

5 files changed

+26
-15
lines changed

5 files changed

+26
-15
lines changed

elasticsearch_dsl/document.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ def mget(
244244
for doc in docs
245245
]
246246
}
247-
results = es.mget(body, index=cls._default_index(index), **kwargs)
247+
results = es.mget(index=cls._default_index(index), body=body, **kwargs)
248248

249249
objs, error_docs, missing_docs = [], [], []
250250
for doc in results["docs"]:

setup.cfg

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,13 @@ all_files = 1
55

66
[isort]
77
profile = black
8+
9+
[tool:pytest]
10+
filterwarnings =
11+
error
12+
# The body parameter is no longer deprecated, see
13+
# https://github.com/elastic/elasticsearch-py/issues/2181#issuecomment-1490932964
14+
ignore:The 'body' parameter is deprecated .*:DeprecationWarning
15+
# calendar_interval was only added in Elasticsearch 7.2 and we still support Elasticsearch 7.0
16+
# using `default` instead of `ignore` to show it in the output as a reminder to remove it for Elasticsearch 8
17+
default:\[interval\] on \[date_histogram\] is deprecated, use \[fixed_interval\] or \[calendar_interval\] in the future.:elasticsearch.exceptions.ElasticsearchWarning

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@
3333
]
3434

3535
develop_requires = [
36-
"pytest>=3.0.0",
36+
"pytest",
3737
"pytest-cov",
38-
"pytest-mock<3.0.0",
38+
"pytest-mock",
3939
"pytz",
40-
"coverage<5.0.0",
40+
"coverage",
4141
"sphinx",
4242
"sphinx_rtd_theme",
4343
]

tests/conftest.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ def es_version(client):
131131
@fixture
132132
def write_client(client):
133133
yield client
134-
client.indices.delete("test-*", ignore=404)
135-
client.indices.delete_template("test-template", ignore=404)
134+
client.indices.delete(index="test-*", ignore=404)
135+
client.indices.delete_template(name="test-template", ignore=404)
136136

137137

138138
@fixture
@@ -154,8 +154,8 @@ def data_client(client):
154154
bulk(client, DATA, raise_on_error=True, refresh=True)
155155
bulk(client, FLAT_DATA, raise_on_error=True, refresh=True)
156156
yield client
157-
client.indices.delete("git")
158-
client.indices.delete("flat-git")
157+
client.indices.delete(index="git")
158+
client.indices.delete(index="flat-git")
159159

160160

161161
@fixture

tests/test_integration/test_examples/test_alias_migration.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,14 @@ def test_alias_migration(write_client):
3333
index_name, _ = indices.popitem()
3434

3535
# which means we can now save a document
36-
bp = BlogPost(
37-
_id=0,
38-
title="Hello World!",
39-
tags=["testing", "dummy"],
40-
content=open(__file__).read(),
41-
)
42-
bp.save(refresh=True)
36+
with open(__file__) as f:
37+
bp = BlogPost(
38+
_id=0,
39+
title="Hello World!",
40+
tags=["testing", "dummy"],
41+
content=f.read(),
42+
)
43+
bp.save(refresh=True)
4344

4445
assert BlogPost.search().count() == 1
4546

0 commit comments

Comments
 (0)