vincbeck commented on code in PR #43175:
URL: https://github.com/apache/airflow/pull/43175#discussion_r1806915443
##########
tests/conftest.py:
##########
@@ -58,6 +61,26 @@ def reset_environment():
os.environ[key] = init_env[key]
+def remove_non_pytest_log_handlers(logger, *classes):
+ for handler in non_pytest_handlers(logger.handlers):
+ logger.removeHandler(handler)
+
+
+def remove_all_non_pytest_log_handlers():
+ # Remove handlers from the root logger
+ remove_non_pytest_log_handlers(logging.getLogger())
+ # Remove handlers from all other loggers
+ for logger_name in logging.root.manager.loggerDict:
+ remove_non_pytest_log_handlers(logging.getLogger(logger_name))
+
+
[email protected]
+def clear_all_logger_handlers():
Review Comment:
Should not we set `autouse=True` so that this fixture is automatically
applied to all tests? These failures are quite intermittent so I think it can
be easy to miss some of them (and also hard to anticipate, in my opinion)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]