[7.x] Use ElasticsearchWarning instead of ElasticsearchDeprecationWarning

Co-authored-by: Seth Michael Larson <[email protected]>
This commit is contained in:
github-actions[bot]
2021-01-04 17:07:55 -06:00
committed by GitHub
co-authored by Seth Michael Larson
parent b1e7bd501b
commit f9f6eac9f1
6 changed files with 21 additions and 11 deletions
@@ -29,7 +29,7 @@ import yaml
import warnings
import pytest
from elasticsearch import TransportError, RequestError, ElasticsearchDeprecationWarning
from elasticsearch import TransportError, RequestError, ElasticsearchWarning
from elasticsearch.compat import string_types
from elasticsearch.helpers.test import _get_version
@@ -147,7 +147,7 @@ class YamlRunner:
for k in args:
args[k] = self._resolve(args[k])
warnings.simplefilter("always", category=ElasticsearchDeprecationWarning)
warnings.simplefilter("always", category=ElasticsearchWarning)
with warnings.catch_warnings(record=True) as caught_warnings:
try:
self.last_response = api(**args)
@@ -165,7 +165,7 @@ class YamlRunner:
caught_warnings = [
str(w.message)
for w in caught_warnings
if w.category == ElasticsearchDeprecationWarning
if w.category == ElasticsearchWarning
and str(w.message) not in allowed_warnings
]