diff --git a/airflow/utils/log/logging_mixin.py b/airflow/utils/log/logging_mixin.py index 90131d10402da..95d137d3bc588 100644 --- a/airflow/utils/log/logging_mixin.py +++ b/airflow/utils/log/logging_mixin.py @@ -95,6 +95,14 @@ def __init__(self, logger, level): self.level = level self._buffer = str() + def close(self): + """ + Provide close method, for compatibility with the io.IOBase interface. + + This is a no-op method. + """ + pass + @property def closed(self): """ diff --git a/tests/utils/test_logging_mixin.py b/tests/utils/test_logging_mixin.py index 4f557167b6fdb..98a04c252baec 100644 --- a/tests/utils/test_logging_mixin.py +++ b/tests/utils/test_logging_mixin.py @@ -116,3 +116,10 @@ def test_encoding(self): log = StreamLogWriter(logger, 1) self.assertIsNone(log.encoding) + + def test_iobase_compatibility(self): + log = StreamLogWriter(None, 1) + + self.assertFalse(log.closed) + # has no specific effect + log.close()