You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/12/20 16:28:21 UTC

[GitHub] [airflow] jobegrabber opened a new pull request #20428: Fix setting of project ID in provide_authorized_gcloud

jobegrabber opened a new pull request #20428:
URL: https://github.com/apache/airflow/pull/20428


   fixes: #20426 
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] jobegrabber edited a comment on pull request #20428: Fix setting of project ID in provide_authorized_gcloud

Posted by GitBox <gi...@apache.org>.
jobegrabber edited a comment on pull request #20428:
URL: https://github.com/apache/airflow/pull/20428#issuecomment-998175240


   > Would it be possible to add a unit test covering this case @jobegrabber ?
   
   I'll try and see if I can set one up, I haven't contributed anything yet so I'll need to check out the dev setup first πŸ™‚ 


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] jobegrabber commented on pull request #20428: Fix setting of project ID in provide_authorized_gcloud

Posted by GitBox <gi...@apache.org>.
jobegrabber commented on pull request #20428:
URL: https://github.com/apache/airflow/pull/20428#issuecomment-999443281


   > No worries, I will create an issue for that and we will fix it. Also might make sense to ban using "has_calls" in our tests in this case!
   
   Thanks! I don't think there is anything else to do on this specific PR, is there?


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] jobegrabber commented on pull request #20428: Fix setting of project ID in provide_authorized_gcloud

Posted by GitBox <gi...@apache.org>.
jobegrabber commented on pull request #20428:
URL: https://github.com/apache/airflow/pull/20428#issuecomment-998175240


   > Would it be possible to add a unit test covering this case @jobegrabber ?
   
   I'll try and see if I can set one up, I haven't contributed anything yet so I'll need check the dev setup out first πŸ™‚ 


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] jobegrabber edited a comment on pull request #20428: Fix setting of project ID in provide_authorized_gcloud

Posted by GitBox <gi...@apache.org>.
jobegrabber edited a comment on pull request #20428:
URL: https://github.com/apache/airflow/pull/20428#issuecomment-998716285


   > @potiuk I didn't have to add new tests, some of the existing ones are broken, among them the one that checks authentication with Google ADC.
   > 
   > For some reason, `has_calls` is used instead of `assert_has_calls`. I couldn't find any documentation of `has_calls`, but it seems to do the same thing as `assert_has_calls`, just that it returns a boolean instead of doing an assertion on its own. This means the affected tests don't actually assert anything, making them pass although they shouldn't.
   > 
   > There are a couple of other places where `has_calls` is used:
   > 
   > ```
   > (airflow-env) ➜  airflow git:(main) βœ— egrep -ir '[^_]has_calls' .
   > ./tests/providers/google/common/hooks/test_base_google.py:        mock_check_output.has_calls(
   > ./tests/providers/google/common/hooks/test_base_google.py:        mock_check_output.has_calls(
   > ./tests/providers/google/cloud/transfers/test_sheets_to_gcs.py:        mock_sheet_hook.return_value.get_values.has_calls(calls)
   > ./tests/providers/google/cloud/transfers/test_sheets_to_gcs.py:        mock_upload_data.has_calls(calls)
   > ./tests/providers/google/cloud/hooks/test_bigquery.py:        mock_poll_job_complete.has_calls(mock.call(running_job_id), mock.call(running_job_id))
   > ./tests/providers/google/cloud/hooks/test_bigquery.py:        mock_schema.has_calls([mock.call(x, "") for x in ["field_1", "field_2"]])
   > ./tests/providers/google/cloud/hooks/test_bigquery.py:        assert mock_insert.has_calls(
   > ./tests/providers/google/cloud/hooks/test_pubsub.py:        publish_method.has_calls(calls)
   > ./tests/providers/google/cloud/hooks/test_cloud_memorystore.py:        mock_get_conn.return_value.get_instance.has_calls(
   > ./tests/providers/google/cloud/hooks/test_cloud_memorystore.py:        mock_get_conn.return_value.get_instance.has_calls(
   > ./tests/providers/google/cloud/hooks/test_cloud_memorystore.py:        mock_get_conn.return_value.get_instance.has_calls(
   > ./tests/providers/google/cloud/hooks/test_dataproc.py:        mock_get_job.has_calls(calls)
   > ./tests/providers/google/cloud/hooks/test_dataproc.py:            mock_get_job.has_calls(calls)
   > ./tests/providers/google/suite/operators/test_sheets.py:        mock_xcom.has_calls(calls)
   > ./tests/providers/http/operators/test_http.py:            mock_info.has_calls(calls)
   > ./tests/providers/airbyte/hooks/test_airbyte.py:        assert mock_get_job.has_calls(calls)
   > ./tests/providers/airbyte/hooks/test_airbyte.py:        assert mock_get_job.has_calls(calls)
   > ./tests/providers/airbyte/hooks/test_airbyte.py:        assert mock_get_job.has_calls(calls)
   > ./tests/providers/airbyte/hooks/test_airbyte.py:        assert mock_get_job.has_calls(calls)
   > ./tests/providers/airbyte/hooks/test_airbyte.py:        assert mock_get_job.has_calls(calls)
   > ```
   > 
   > I don't think I have the time to fix all these in a short time frame, I haven't looked at these parts at all..
   
   Actually, `has_calls` should simply create a new mock on `mock_check_output` ..


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] boring-cyborg[bot] commented on pull request #20428: Fix setting of project ID in provide_authorized_gcloud

Posted by GitBox <gi...@apache.org>.
boring-cyborg[bot] commented on pull request #20428:
URL: https://github.com/apache/airflow/pull/20428#issuecomment-998082148


   Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst)
   Here are some useful points:
   - Pay attention to the quality of your code (flake8, mypy and type annotations). Our [pre-commits]( https://github.com/apache/airflow/blob/main/STATIC_CODE_CHECKS.rst#prerequisites-for-pre-commit-hooks) will help you with that.
   - In case of a new feature add useful documentation (in docstrings or in `docs/` directory). Adding a new operator? Check this short [guide](https://github.com/apache/airflow/blob/main/docs/apache-airflow/howto/custom-operator.rst) Consider adding an example DAG that shows how users should use it.
   - Consider using [Breeze environment](https://github.com/apache/airflow/blob/main/BREEZE.rst) for testing locally, it’s a heavy docker but it ships with a working Airflow and a lot of integrations.
   - Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
   - Please follow [ASF Code of Conduct](https://www.apache.org/foundation/policies/conduct) for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
   - Be sure to read the [Airflow Coding style]( https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#coding-style-and-best-practices).
   Apache Airflow is a community-driven project and together we are making it better πŸš€.
   In case of doubts contact the developers at:
   Mailing List: dev@airflow.apache.org
   Slack: https://s.apache.org/airflow-slack
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] jobegrabber edited a comment on pull request #20428: Fix setting of project ID in provide_authorized_gcloud

Posted by GitBox <gi...@apache.org>.
jobegrabber edited a comment on pull request #20428:
URL: https://github.com/apache/airflow/pull/20428#issuecomment-998714275


   @potiuk I didn't have to add new tests, some of the existing ones are broken, among them the one that checks authentication with Google ADC.
   
   For some reason, `has_calls` is used instead of `assert_has_calls`. I couldn't find any documentation of `has_calls`, ~but it seems to do the same thing as `assert_has_calls`, just that it returns a boolean instead of doing an assertion on its own.~ (**EDIT**: I'm wrong, it just seems to create a new mock ad-hoc..)This means the affected tests don't actually assert anything, making them pass although they shouldn't.
   
   There are a couple of other places where `has_calls` is used:
   
   ```
   (airflow-env) ➜  airflow git:(main) βœ— egrep -ir '[^_]has_calls' .
   ./tests/providers/google/common/hooks/test_base_google.py:        mock_check_output.has_calls(
   ./tests/providers/google/common/hooks/test_base_google.py:        mock_check_output.has_calls(
   ./tests/providers/google/cloud/transfers/test_sheets_to_gcs.py:        mock_sheet_hook.return_value.get_values.has_calls(calls)
   ./tests/providers/google/cloud/transfers/test_sheets_to_gcs.py:        mock_upload_data.has_calls(calls)
   ./tests/providers/google/cloud/hooks/test_bigquery.py:        mock_poll_job_complete.has_calls(mock.call(running_job_id), mock.call(running_job_id))
   ./tests/providers/google/cloud/hooks/test_bigquery.py:        mock_schema.has_calls([mock.call(x, "") for x in ["field_1", "field_2"]])
   ./tests/providers/google/cloud/hooks/test_bigquery.py:        assert mock_insert.has_calls(
   ./tests/providers/google/cloud/hooks/test_pubsub.py:        publish_method.has_calls(calls)
   ./tests/providers/google/cloud/hooks/test_cloud_memorystore.py:        mock_get_conn.return_value.get_instance.has_calls(
   ./tests/providers/google/cloud/hooks/test_cloud_memorystore.py:        mock_get_conn.return_value.get_instance.has_calls(
   ./tests/providers/google/cloud/hooks/test_cloud_memorystore.py:        mock_get_conn.return_value.get_instance.has_calls(
   ./tests/providers/google/cloud/hooks/test_dataproc.py:        mock_get_job.has_calls(calls)
   ./tests/providers/google/cloud/hooks/test_dataproc.py:            mock_get_job.has_calls(calls)
   ./tests/providers/google/suite/operators/test_sheets.py:        mock_xcom.has_calls(calls)
   ./tests/providers/http/operators/test_http.py:            mock_info.has_calls(calls)
   ./tests/providers/airbyte/hooks/test_airbyte.py:        assert mock_get_job.has_calls(calls)
   ./tests/providers/airbyte/hooks/test_airbyte.py:        assert mock_get_job.has_calls(calls)
   ./tests/providers/airbyte/hooks/test_airbyte.py:        assert mock_get_job.has_calls(calls)
   ./tests/providers/airbyte/hooks/test_airbyte.py:        assert mock_get_job.has_calls(calls)
   ./tests/providers/airbyte/hooks/test_airbyte.py:        assert mock_get_job.has_calls(calls)
   ```
   
   I don't think I have the time to fix all these in a short time frame, I haven't looked at these parts at all..


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] jobegrabber edited a comment on pull request #20428: Fix setting of project ID in provide_authorized_gcloud

Posted by GitBox <gi...@apache.org>.
jobegrabber edited a comment on pull request #20428:
URL: https://github.com/apache/airflow/pull/20428#issuecomment-998714275


   @potiuk I didn't have to add new tests, some of the existing ones are broken, among them the one that checks authentication with Google ADC.
   
   For some reason, `has_calls` is used instead of `assert_has_calls`. I couldn't find any documentation of `has_calls`, but it seems to do the same thing as `assert_has_calls`, just that it returns a boolean instead of doing an assertion on its own. This means the affected tests don't actually assert anything, making them pass although they shouldn't.
   
   There are a couple of other places where `has_calls` is used:
   
   ```
   (airflow-env) ➜  airflow git:(main) βœ— egrep -ir '[^_]has_calls' .
   ./tests/providers/google/common/hooks/test_base_google.py:        mock_check_output.has_calls(
   ./tests/providers/google/common/hooks/test_base_google.py:        mock_check_output.has_calls(
   ./tests/providers/google/cloud/transfers/test_sheets_to_gcs.py:        mock_sheet_hook.return_value.get_values.has_calls(calls)
   ./tests/providers/google/cloud/transfers/test_sheets_to_gcs.py:        mock_upload_data.has_calls(calls)
   ./tests/providers/google/cloud/hooks/test_bigquery.py:        mock_poll_job_complete.has_calls(mock.call(running_job_id), mock.call(running_job_id))
   ./tests/providers/google/cloud/hooks/test_bigquery.py:        mock_schema.has_calls([mock.call(x, "") for x in ["field_1", "field_2"]])
   ./tests/providers/google/cloud/hooks/test_bigquery.py:        assert mock_insert.has_calls(
   ./tests/providers/google/cloud/hooks/test_pubsub.py:        publish_method.has_calls(calls)
   ./tests/providers/google/cloud/hooks/test_cloud_memorystore.py:        mock_get_conn.return_value.get_instance.has_calls(
   ./tests/providers/google/cloud/hooks/test_cloud_memorystore.py:        mock_get_conn.return_value.get_instance.has_calls(
   ./tests/providers/google/cloud/hooks/test_cloud_memorystore.py:        mock_get_conn.return_value.get_instance.has_calls(
   ./tests/providers/google/cloud/hooks/test_dataproc.py:        mock_get_job.has_calls(calls)
   ./tests/providers/google/cloud/hooks/test_dataproc.py:            mock_get_job.has_calls(calls)
   ./tests/providers/google/suite/operators/test_sheets.py:        mock_xcom.has_calls(calls)
   ./tests/providers/http/operators/test_http.py:            mock_info.has_calls(calls)
   ./tests/providers/airbyte/hooks/test_airbyte.py:        assert mock_get_job.has_calls(calls)
   ./tests/providers/airbyte/hooks/test_airbyte.py:        assert mock_get_job.has_calls(calls)
   ./tests/providers/airbyte/hooks/test_airbyte.py:        assert mock_get_job.has_calls(calls)
   ./tests/providers/airbyte/hooks/test_airbyte.py:        assert mock_get_job.has_calls(calls)
   ./tests/providers/airbyte/hooks/test_airbyte.py:        assert mock_get_job.has_calls(calls)
   ```
   
   I don't think I have the time to fix all these in a short time frame, I haven't looked at these parts at all..


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] kaxil commented on pull request #20428: Fix setting of project ID in provide_authorized_gcloud

Posted by GitBox <gi...@apache.org>.
kaxil commented on pull request #20428:
URL: https://github.com/apache/airflow/pull/20428#issuecomment-1003413803


   Thanks for the PR, well done πŸ‘ 


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on pull request #20428: Fix setting of project ID in provide_authorized_gcloud

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #20428:
URL: https://github.com/apache/airflow/pull/20428#issuecomment-999033755


   > For some reason, `has_calls` is used instead of `assert_has_calls`. I couldn't find any documentation of `has_calls`, ~but it seems to do the same thing as `assert_has_calls`, just that it returns a boolean instead of doing an assertion on its own.~ (**EDIT**: I'm wrong, it just seems to create a new mock ad-hoc..)This means the affected tests don't actually assert anything, making them pass although they shouldn't.
   
   UPS!
   
   > 
   > There are a couple of other places where `has_calls` is used:
   > 
   > ```
   > (airflow-env) ➜  airflow git:(main) βœ— egrep -ir '[^_]has_calls' .
   > ./tests/providers/google/common/hooks/test_base_google.py:        mock_check_output.has_calls(
   > ./tests/providers/google/common/hooks/test_base_google.py:        mock_check_output.has_calls(
   > ./tests/providers/google/cloud/transfers/test_sheets_to_gcs.py:        mock_sheet_hook.return_value.get_values.has_calls(calls)
   > ./tests/providers/google/cloud/transfers/test_sheets_to_gcs.py:        mock_upload_data.has_calls(calls)
   > ./tests/providers/google/cloud/hooks/test_bigquery.py:        mock_poll_job_complete.has_calls(mock.call(running_job_id), mock.call(running_job_id))
   > ./tests/providers/google/cloud/hooks/test_bigquery.py:        mock_schema.has_calls([mock.call(x, "") for x in ["field_1", "field_2"]])
   > ./tests/providers/google/cloud/hooks/test_bigquery.py:        assert mock_insert.has_calls(
   > ./tests/providers/google/cloud/hooks/test_pubsub.py:        publish_method.has_calls(calls)
   > ./tests/providers/google/cloud/hooks/test_cloud_memorystore.py:        mock_get_conn.return_value.get_instance.has_calls(
   > ./tests/providers/google/cloud/hooks/test_cloud_memorystore.py:        mock_get_conn.return_value.get_instance.has_calls(
   > ./tests/providers/google/cloud/hooks/test_cloud_memorystore.py:        mock_get_conn.return_value.get_instance.has_calls(
   > ./tests/providers/google/cloud/hooks/test_dataproc.py:        mock_get_job.has_calls(calls)
   > ./tests/providers/google/cloud/hooks/test_dataproc.py:            mock_get_job.has_calls(calls)
   > ./tests/providers/google/suite/operators/test_sheets.py:        mock_xcom.has_calls(calls)
   > ./tests/providers/http/operators/test_http.py:            mock_info.has_calls(calls)
   > ./tests/providers/airbyte/hooks/test_airbyte.py:        assert mock_get_job.has_calls(calls)
   > ./tests/providers/airbyte/hooks/test_airbyte.py:        assert mock_get_job.has_calls(calls)
   > ./tests/providers/airbyte/hooks/test_airbyte.py:        assert mock_get_job.has_calls(calls)
   > ./tests/providers/airbyte/hooks/test_airbyte.py:        assert mock_get_job.has_calls(calls)
   > ./tests/providers/airbyte/hooks/test_airbyte.py:        assert mock_get_job.has_calls(calls)
   
   
   AH COOL. We should fix them.
   
   
   > I don't think I have the time to fix all these in a short time frame, I haven't looked at these parts at all..
   
   No worries, I will create an issue for that and we will fix it. Also might make sense to ban using "has_calls" in our tests in this case!
   
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] uranusjr commented on pull request #20428: Fix setting of project ID in provide_authorized_gcloud

Posted by GitBox <gi...@apache.org>.
uranusjr commented on pull request #20428:
URL: https://github.com/apache/airflow/pull/20428#issuecomment-999234464


   cc @deedmitrij


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] boring-cyborg[bot] commented on pull request #20428: Fix setting of project ID in provide_authorized_gcloud

Posted by GitBox <gi...@apache.org>.
boring-cyborg[bot] commented on pull request #20428:
URL: https://github.com/apache/airflow/pull/20428#issuecomment-1003413776


   Awesome work, congrats on your first merged pull request!
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] github-actions[bot] commented on pull request #20428: Fix setting of project ID in provide_authorized_gcloud

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #20428:
URL: https://github.com/apache/airflow/pull/20428#issuecomment-998118027


   The PR is likely OK to be merged with just subset of tests for default Python and Database versions without running the full matrix of tests, because it does not modify the core of Airflow. If the committers decide that the full tests matrix is needed, they will add the label 'full tests needed'. Then you should rebase to the latest main or amend the last commit of the PR, and push it with --force-with-lease.


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] kaxil merged pull request #20428: Fix setting of project ID in provide_authorized_gcloud

Posted by GitBox <gi...@apache.org>.
kaxil merged pull request #20428:
URL: https://github.com/apache/airflow/pull/20428


   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] jobegrabber commented on pull request #20428: Fix setting of project ID in provide_authorized_gcloud

Posted by GitBox <gi...@apache.org>.
jobegrabber commented on pull request #20428:
URL: https://github.com/apache/airflow/pull/20428#issuecomment-998716285


   > @potiuk I didn't have to add new tests, some of the existing ones are broken, among them the one that checks authentication with Google ADC.
   > 
   > For some reason, `has_calls` is used instead of `assert_has_calls`. I couldn't find any documentation of `has_calls`, but it seems to do the same thing as `assert_has_calls`, just that it returns a boolean instead of doing an assertion on its own. This means the affected tests don't actually assert anything, making them pass although they shouldn't.
   > 
   > There are a couple of other places where `has_calls` is used:
   > 
   > ```
   > (airflow-env) ➜  airflow git:(main) βœ— egrep -ir '[^_]has_calls' .
   > ./tests/providers/google/common/hooks/test_base_google.py:        mock_check_output.has_calls(
   > ./tests/providers/google/common/hooks/test_base_google.py:        mock_check_output.has_calls(
   > ./tests/providers/google/cloud/transfers/test_sheets_to_gcs.py:        mock_sheet_hook.return_value.get_values.has_calls(calls)
   > ./tests/providers/google/cloud/transfers/test_sheets_to_gcs.py:        mock_upload_data.has_calls(calls)
   > ./tests/providers/google/cloud/hooks/test_bigquery.py:        mock_poll_job_complete.has_calls(mock.call(running_job_id), mock.call(running_job_id))
   > ./tests/providers/google/cloud/hooks/test_bigquery.py:        mock_schema.has_calls([mock.call(x, "") for x in ["field_1", "field_2"]])
   > ./tests/providers/google/cloud/hooks/test_bigquery.py:        assert mock_insert.has_calls(
   > ./tests/providers/google/cloud/hooks/test_pubsub.py:        publish_method.has_calls(calls)
   > ./tests/providers/google/cloud/hooks/test_cloud_memorystore.py:        mock_get_conn.return_value.get_instance.has_calls(
   > ./tests/providers/google/cloud/hooks/test_cloud_memorystore.py:        mock_get_conn.return_value.get_instance.has_calls(
   > ./tests/providers/google/cloud/hooks/test_cloud_memorystore.py:        mock_get_conn.return_value.get_instance.has_calls(
   > ./tests/providers/google/cloud/hooks/test_dataproc.py:        mock_get_job.has_calls(calls)
   > ./tests/providers/google/cloud/hooks/test_dataproc.py:            mock_get_job.has_calls(calls)
   > ./tests/providers/google/suite/operators/test_sheets.py:        mock_xcom.has_calls(calls)
   > ./tests/providers/http/operators/test_http.py:            mock_info.has_calls(calls)
   > ./tests/providers/airbyte/hooks/test_airbyte.py:        assert mock_get_job.has_calls(calls)
   > ./tests/providers/airbyte/hooks/test_airbyte.py:        assert mock_get_job.has_calls(calls)
   > ./tests/providers/airbyte/hooks/test_airbyte.py:        assert mock_get_job.has_calls(calls)
   > ./tests/providers/airbyte/hooks/test_airbyte.py:        assert mock_get_job.has_calls(calls)
   > ./tests/providers/airbyte/hooks/test_airbyte.py:        assert mock_get_job.has_calls(calls)
   > ```
   > 
   > I don't think I have the time to fix all these in a short time frame, I haven't looked at these parts at all..
   
   Actually, `has_calls` may simply create a new mock on `mock_check_output` πŸ€” πŸ˜… 


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on pull request #20428: Fix setting of project ID in provide_authorized_gcloud

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #20428:
URL: https://github.com/apache/airflow/pull/20428#issuecomment-998118203


   Would it be possible to add a unit test covering this case @jobegrabber ? Woudl be great to avoid regressions in the future


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] jobegrabber commented on pull request #20428: Fix setting of project ID in provide_authorized_gcloud

Posted by GitBox <gi...@apache.org>.
jobegrabber commented on pull request #20428:
URL: https://github.com/apache/airflow/pull/20428#issuecomment-998714275


   @potiuk I didn't have to add new tests, some of the existing ones are broken, among them the one that checks authentication with Google ADC.
   
   For some reason, `has_calls` is used instead of `assert_has_calls`. I couldn't find any documentation of `has_calls`, but it seems to do the same thing as `assert_has_calls`, just that it returns a boolean instead of doing an assertion on its own. This means the affected tests don't actually assert anything, making them pass although they shouldn't.
   
   There are a couple of other places where `has_calls` is used:
   
   ```
   (airflow-env) ➜  airflow git:(main) βœ— egrep -ir '[^_]has_calls' .
   ./tests/providers/google/common/hooks/test_base_google.py:        mock_check_output.has_calls(
   ./tests/providers/google/common/hooks/test_base_google.py:        mock_check_output.has_calls(
   ./tests/providers/google/cloud/transfers/test_sheets_to_gcs.py:        mock_sheet_hook.return_value.get_values.has_calls(calls)
   ./tests/providers/google/cloud/transfers/test_sheets_to_gcs.py:        mock_upload_data.has_calls(calls)
   ./tests/providers/google/cloud/hooks/test_bigquery.py:        mock_poll_job_complete.has_calls(mock.call(running_job_id), mock.call(running_job_id))
   ./tests/providers/google/cloud/hooks/test_bigquery.py:        mock_schema.has_calls([mock.call(x, "") for x in ["field_1", "field_2"]])
   ./tests/providers/google/cloud/hooks/test_bigquery.py:        assert mock_insert.has_calls(
   ./tests/providers/google/cloud/hooks/test_pubsub.py:        publish_method.has_calls(calls)
   ./tests/providers/google/cloud/hooks/test_cloud_memorystore.py:        mock_get_conn.return_value.get_instance.has_calls(
   ./tests/providers/google/cloud/hooks/test_cloud_memorystore.py:        mock_get_conn.return_value.get_instance.has_calls(
   ./tests/providers/google/cloud/hooks/test_cloud_memorystore.py:        mock_get_conn.return_value.get_instance.has_calls(
   ./tests/providers/google/cloud/hooks/test_dataproc.py:        mock_get_job.has_calls(calls)
   ./tests/providers/google/cloud/hooks/test_dataproc.py:            mock_get_job.has_calls(calls)
   ./tests/providers/google/suite/operators/test_sheets.py:        mock_xcom.has_calls(calls)
   ./tests/providers/http/operators/test_http.py:            mock_info.has_calls(calls)
   ./tests/providers/airbyte/hooks/test_airbyte.py:        assert mock_get_job.has_calls(calls)
   ./tests/providers/airbyte/hooks/test_airbyte.py:        assert mock_get_job.has_calls(calls)
   ./tests/providers/airbyte/hooks/test_airbyte.py:        assert mock_get_job.has_calls(calls)
   ./tests/providers/airbyte/hooks/test_airbyte.py:        assert mock_get_job.has_calls(calls)
   ./tests/providers/airbyte/hooks/test_airbyte.py:        assert mock_get_job.has_calls(calls)
   ```
   
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org