mik-laj commented on a change in pull request #8732:
URL: https://github.com/apache/airflow/pull/8732#discussion_r420956430



##########
File path: tests/plugins/test_plugins_manager.py
##########
@@ -64,3 +65,32 @@ def test_app_blueprints(self):
         # Blueprint should be present in the app
         self.assertTrue('test_plugin' in self.app.blueprints)
         self.assertEqual(self.app.blueprints['test_plugin'].name, bp.name)
+
+
[email protected]('airflow.plugins_manager.import_errors', return_value={})
[email protected]('airflow.plugins_manager.plugins', return_value=[])
[email protected]('airflow.plugins_manager.pkg_resources.iter_entry_points')
+def test_entrypoint_plugin_errors_dont_raise_exceptions(
+    mock_ep_plugins, mock_plugins, mock_import_errors, caplog
+):
+    """
+    Test that Airflow does not raise an Error if there is any Exception 
because of the
+    Plugin.
+    """
+    from airflow.plugins_manager import load_entrypoint_plugins, import_errors
+
+    mock_entrypoint = mock.Mock()
+    mock_entrypoint.name = 'test-entrypoint'
+    mock_entrypoint.module_name = 'test.plugins.test_plugins_manager'
+    mock_entrypoint.load.side_effect = Exception('Version Conflict')
+    mock_ep_plugins.return_value = [mock_entrypoint]
+
+    # Clear Logs
+    caplog.clear()

Review comment:
       This causes some problems. Personally, I use `self.assertLogs`. However, 
we have a side effect in the global configuration of the logger and you must 
pass the logger as a parameter for it to work.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to