Skip to content

Fix deprecation warnings #1663

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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