potiuk commented on a change in pull request #21074:
URL: https://github.com/apache/airflow/pull/21074#discussion_r793061206
##########
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:
Right. I think I have better/true unit test cases - also while testing
it, I found that we can improve the import a little bit -rather than importing
Hooks once in sanity check and second time in _import_hooks, we import it only
once in the _sanity_check and use imported Hook class after + I fixed class
methods definition good for MyPy.
--
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]