From 60c0ab2ea0533dabbcd6315357d426549ace5c9d Mon Sep 17 00:00:00 2001 From: Alistair Coles Date: Fri, 20 Sep 2024 15:59:04 +0100 Subject: [PATCH] Quiten boto logging in func tests Some s3api functional tests were setting boto logging level to DEBUG, which results in a very large amount of logging output from the test runner, including large request bodies. This makes it extremely hard to inspect test output. This patch makes the quiet_boto_logging context manager revert the logger level to its original value rather than indiscriminately leaving it set to DEBUG. Change-Id: I1dd9603adf9a19e89da5a461d3c6810a3432ae46 --- test/functional/s3api/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/functional/s3api/__init__.py b/test/functional/s3api/__init__.py index b770d8635b..9f402a4e95 100644 --- a/test/functional/s3api/__init__.py +++ b/test/functional/s3api/__init__.py @@ -45,11 +45,12 @@ class S3ApiBase(unittest.TestCase): @contextmanager def quiet_boto_logging(self): + original_level = logging.getLogger('boto').getEffectiveLevel() try: logging.getLogger('boto').setLevel(logging.INFO) yield finally: - logging.getLogger('boto').setLevel(logging.DEBUG) + logging.getLogger('boto').setLevel(original_level) def setUp(self): if not tf.config.get('s3_access_key'):