SameerMesiah97 commented on code in PR #77248:
URL: https://github.com/apache/airflow/pull/77248#discussion_r4619445293
##########
providers/odbc/tests/unit/odbc/hooks/test_odbc.py:
##########
@@ -252,10 +252,12 @@ def
test_allow_driver_in_extra_default_is_resolved_without_fallback(self):
assert conf.getboolean("providers.odbc", "allow_driver_in_extra") is
False
- def test_default_driver_set(self):
+ def test_default_driver_set(self, caplog):
with patch.object(OdbcHook, "default_driver", "Blah driver"):
- hook = mock_db_hook(OdbcHook)
- assert hook.driver == "Blah driver"
+ with caplog.at_level(logging.WARNING,
logger="airflow.providers.odbc.hooks.odbc"):
Review Comment:
nit: you could combine the nested context managers like the below:
```
def test_default_driver_set(self, caplog):
with (
patch.object(OdbcHook, "default_driver", "Blah driver"),
caplog.at_level(logging.WARNING,
logger="airflow.providers.odbc.hooks.odbc"),
):
hook = mock_db_hook(OdbcHook)
assert hook.driver == "Blah driver"
assert "You have supplied 'driver' via connection extra" not in
caplog.text
```
--
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]