From 345f763fa757f4810b2c8bc7ce741bda463c954f Mon Sep 17 00:00:00 2001 From: dblock Date: Fri, 27 Sep 2024 07:45:35 -0400 Subject: [PATCH 1/2] Fix: don't rely on a specific plugin for the test. Signed-off-by: dblock --- test_opensearchpy/test_async/test_plugins_client.py | 8 ++++---- .../test_client/test_plugins/test_plugins_client.py | 11 +++++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/test_opensearchpy/test_async/test_plugins_client.py b/test_opensearchpy/test_async/test_plugins_client.py index 3e0141115..1ee4d17ba 100644 --- a/test_opensearchpy/test_async/test_plugins_client.py +++ b/test_opensearchpy/test_async/test_plugins_client.py @@ -8,6 +8,7 @@ # GitHub history for details. +import re import warnings import pytest @@ -24,8 +25,7 @@ async def test_plugins_client(self) -> None: client = AsyncOpenSearch() # testing double-init here client.plugins.__init__(client) # type: ignore # pylint: disable=unnecessary-dunder-call - assert ( - str(w[0].message) - == "Cannot load `alerting` directly to AsyncOpenSearch as it already exists. Use " - "`AsyncOpenSearch.plugin.alerting` instead." + assert re.match( + r"Cannot load `\w+` directly to AsyncOpenSearch as it already exists. Use `AsyncOpenSearch.plugin.\w+` instead.", + str(w[0].message), ) diff --git a/test_opensearchpy/test_client/test_plugins/test_plugins_client.py b/test_opensearchpy/test_client/test_plugins/test_plugins_client.py index 658defa69..0a74a9e18 100644 --- a/test_opensearchpy/test_client/test_plugins/test_plugins_client.py +++ b/test_opensearchpy/test_client/test_plugins/test_plugins_client.py @@ -7,6 +7,8 @@ # Modifications Copyright OpenSearch Contributors. See # GitHub history for details. +import re + from opensearchpy.client import OpenSearch from ...test_cases import TestCase @@ -18,8 +20,9 @@ def test_plugins_client(self) -> None: client = OpenSearch() # double-init client.plugins.__init__(client) # type: ignore # pylint: disable=unnecessary-dunder-call - self.assertEqual( - str(w.warnings[0].message), - "Cannot load `alerting` directly to OpenSearch as " - "it already exists. Use `OpenSearch.plugin.alerting` instead.", + self.assertTrue( + re.match( + r"Cannot load `\w+` directly to OpenSearch as it already exists. Use `OpenSearch.plugin.\w+` instead.", + str(w.warnings[0].message), + ) ) From dcf379b1c60937118e6a22453f05219c00c187ef Mon Sep 17 00:00:00 2001 From: dblock Date: Fri, 27 Sep 2024 08:42:17 -0400 Subject: [PATCH 2/2] Ignore ISM. Signed-off-by: dblock --- utils/generate_api.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/utils/generate_api.py b/utils/generate_api.py index c85ed8d27..8b02e1be6 100644 --- a/utils/generate_api.py +++ b/utils/generate_api.py @@ -704,6 +704,10 @@ def read_modules() -> Any: namespace = "__init__" name = key + # FIXME: we have a hard-coded index_management that needs to be deprecated in favor of the auto-generated one + if namespace == "ism": + continue + # Group the data in the current group by the "path" key paths = [] all_paths_have_deprecation = True