rkarish commented on PR #29079:
URL: https://github.com/apache/airflow/pull/29079#issuecomment-1399383094

   After future investigations I see why these tests are failing. Example - 
`tests/providers/google/cloud/hooks/test_bigquery.py` has a test called 
`test_get_pandas_df()`, in this test there is a `assert_called_once_with()` 
method call on the `mock`. With the changes I've made to the `DbApiHook` to use 
a sqlalchemy engine these tests are failing because 2 calls are being made now. 
Is it acceptable to change the test to something like as follows? 
   
   ```    @mock.patch("airflow.providers.google.cloud.hooks.bigquery.read_gbq")
       def test_get_pandas_df(self, mock_read_gbq):
           self.hook.get_pandas_df("select 1")
   
           mock_read_gbq(
               "select 1", credentials=CREDENTIALS, dialect="legacy", 
project_id=PROJECT_ID, verbose=False, 
           )
   
           assert mock_read_gbq.call_count == 2
   ```
   
   Would like to know if this is the right approach before making similar 
changes to the several tests that are failing.


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