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
This commit is contained in:
Alistair Coles
2024-09-20 15:59:04 +01:00
parent e0a9ea496e
commit 60c0ab2ea0

View File

@@ -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'):