Created
January 19, 2024 22:53
-
-
Save macohen/d7295e07770e13708b62fa00b7f62a9c to your computer and use it in GitHub Desktop.
dunder method pylint
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SPDX-License-Identifier: Apache-2.0 | |
# | |
# The OpenSearch Contributors require contributions made to | |
# this file be licensed under the Apache-2.0 license or a | |
# compatible open source license. | |
# | |
# Modifications Copyright OpenSearch Contributors. See | |
# GitHub history for details. | |
import warnings | |
import pytest | |
from _pytest.mark.structures import MarkDecorator | |
from opensearchpy._async.client import AsyncOpenSearch | |
from opensearchpy.client import PluginsClient | |
pytestmark: MarkDecorator = pytest.mark.asyncio | |
class TestPluginsClient: | |
async def test_plugins_client(self) -> None: | |
with warnings.catch_warnings(record=True) as w: | |
client = AsyncOpenSearch() | |
# testing double-init here | |
client.plugins = PluginsClient(client) | |
#client.plugins.__init__(client) # type: ignore | |
assert ( | |
str(w[0].message) | |
== "Cannot load `alerting` directly to AsyncOpenSearch as it already exists. Use " | |
"`AsyncOpenSearch.plugin.alerting` instead." | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment