Skip to content

Commit

Permalink
Fix deprecation warnings (#1663)
Browse files Browse the repository at this point in the history
  • Loading branch information
pquentin committed Aug 25, 2023
1 parent 9849502 commit 9afbea1
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 15 deletions.
2 changes: 1 addition & 1 deletion elasticsearch_dsl/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def mget(
for doc in docs
]
}
results = es.mget(body, index=cls._default_index(index), **kwargs)
results = es.mget(index=cls._default_index(index), body=body, **kwargs)

objs, error_docs, missing_docs = [], [], []
for doc in results["docs"]:
Expand Down
10 changes: 10 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,13 @@ all_files = 1

[isort]
profile = black

[tool:pytest]
filterwarnings =
error
# The body parameter is no longer deprecated, see
# https://github.com/elastic/elasticsearch-py/issues/2181#issuecomment-1490932964
ignore:The 'body' parameter is deprecated .*:DeprecationWarning
# calendar_interval was only added in Elasticsearch 7.2 and we still support Elasticsearch 7.0
# using `default` instead of `ignore` to show it in the output as a reminder to remove it for Elasticsearch 8
default:\[interval\] on \[date_histogram\] is deprecated, use \[fixed_interval\] or \[calendar_interval\] in the future.:elasticsearch.exceptions.ElasticsearchWarning
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
]

develop_requires = [
"pytest>=3.0.0",
"pytest",
"pytest-cov",
"pytest-mock<3.0.0",
"pytest-mock",
"pytz",
"coverage<5.0.0",
"coverage",
"sphinx",
"sphinx_rtd_theme",
]
Expand Down
8 changes: 4 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ def es_version(client):
@fixture
def write_client(client):
yield client
client.indices.delete("test-*", ignore=404)
client.indices.delete_template("test-template", ignore=404)
client.indices.delete(index="test-*", ignore=404)
client.indices.delete_template(name="test-template", ignore=404)


@fixture
Expand All @@ -154,8 +154,8 @@ def data_client(client):
bulk(client, DATA, raise_on_error=True, refresh=True)
bulk(client, FLAT_DATA, raise_on_error=True, refresh=True)
yield client
client.indices.delete("git")
client.indices.delete("flat-git")
client.indices.delete(index="git")
client.indices.delete(index="flat-git")


@fixture
Expand Down
15 changes: 8 additions & 7 deletions tests/test_integration/test_examples/test_alias_migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,14 @@ def test_alias_migration(write_client):
index_name, _ = indices.popitem()

# which means we can now save a document
bp = BlogPost(
_id=0,
title="Hello World!",
tags=["testing", "dummy"],
content=open(__file__).read(),
)
bp.save(refresh=True)
with open(__file__) as f:
bp = BlogPost(
_id=0,
title="Hello World!",
tags=["testing", "dummy"],
content=f.read(),
)
bp.save(refresh=True)

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

Expand Down

0 comments on commit 9afbea1

Please sign in to comment.