From 7569dc47ab79364d824f39de61b671d956d6a820 Mon Sep 17 00:00:00 2001 From: merlinz01 <158784988+merlinz01@users.noreply.github.com> Date: Fri, 15 Nov 2024 18:37:50 -0500 Subject: [PATCH] Fix test failing on Python >3.12.7 Signed-off-by: merlinz01 <158784988+merlinz01@users.noreply.github.com> --- test_opensearchpy/test_async/test_connection.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test_opensearchpy/test_async/test_connection.py b/test_opensearchpy/test_async/test_connection.py index 9ad21b5d..1b4e8100 100644 --- a/test_opensearchpy/test_async/test_connection.py +++ b/test_opensearchpy/test_async/test_connection.py @@ -29,6 +29,7 @@ import io import json import ssl +import sys import warnings from platform import python_version from typing import Any @@ -228,7 +229,13 @@ async def test_nowarn_when_test_uses_https_if_verify_certs_is_off(self) -> None: use_ssl=True, verify_certs=False, ssl_show_warn=False ) await con._create_aiohttp_session() - assert w == [] + if sys.hexversion < 0x30c0700: + assert w == [] + else: + assert len(w) == 1 + assert (str(w[0].message) == "enable_cleanup_closed ignored because " + "https://github.com/python/cpython/pull/118960 is fixed in " + "Python version sys.version_info(major=3, minor=12, micro=7, releaselevel='final', serial=0)") assert isinstance(con.session, aiohttp.ClientSession)