uranusjr commented on a change in pull request #21074:
URL: https://github.com/apache/airflow/pull/21074#discussion_r792360282



##########
File path: tests/core/test_providers_manager.py
##########
@@ -179,3 +188,13 @@ def test_auth_backends(self):
         provider_manager = ProvidersManager()
         auth_backend_module_names = 
list(provider_manager.auth_backend_module_names)
         assert len(auth_backend_module_names) > 0
+
+    @patch("builtins.__import__", new=raising_import)
+    def test_optional_features(self):
+        with self._caplog.at_level(logging.WARNING):
+            provider_manager = ProvidersManager()
+            list(provider_manager.field_behaviours)
+            # exasol raises regular import error with warning
+            assert "Custom Import Error: pyexasol" in 
str(self._caplog.messages)
+            # leveldb raises the AirflowOptionalProviderFeatureException with 
no warning
+            assert "Custom Import Error: plyvel" not in 
str(self._caplog.messages)

Review comment:
       This doesn’t feel like a good way to test the feature, it depends too 
much on how individual providers are set up. Maybe it’s better to dynamically 
create a fake provider that does the right thing on import instead.




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


Reply via email to