diff --git a/tests/conftest.py b/tests/conftest.py index 9cbe6228fcb..031b5274a55 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,5 +1,6 @@ # Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause +from logging import getLogger from pathlib import Path import pytest @@ -66,3 +67,15 @@ def clear_cuda_version(): def do_not_register_envs(monkeypatch): """Do not register environments created during tests""" monkeypatch.setenv("CONDA_REGISTER_ENVS", "false") + + +@pytest.fixture(autouse=True) +def filter_retry_log_warning(): + """Do not register environments created during tests""" + def log_filter(record): + return not re.match("^Retrying .* after connection broken by", record.msg) + + logger = getLogger("urllib3.connectionpool") + logger.addFilter(log_filter) + yield + logger.removeFilter(log_filter)