ferruzzi commented on PR #27823:
URL: https://github.com/apache/airflow/pull/27823#issuecomment-1336217469
> so there must be something in your changes that cause it
I don't see how that's possible. If I check out main, git pull --rebase,
and run the tests, they fail. My code is all in a different branch.
```
(airflow-env) ferruzzi:~/workplace/airflow (ferruzzi/boto-user-agent)
$ git checkout main
Switched to branch 'main'
Your branch is up to date with 'apache/main'.
(airflow-env) ferruzzi:~/workplace/airflow (main)
$ git pull --rebase
Already up to date.
Current branch main is up to date.
(airflow-env) ferruzzi:~/workplace/airflow (main)
$ pytest
tests/providers/amazon/aws/hooks/test_s3.py::TestAwsS3HookNoMock::test_check_for_bucket_raises_error_with_invalid_conn_id
-W ignore::DeprecationWarning -W ignore::FutureWarning
===========================================================================
test session starts
===========================================================================
platform linux -- Python 3.8.10, pytest-6.2.5, py-1.11.0, pluggy-1.0.0 --
/home/ANT.AMAZON.COM/ferruzzi/.pyenv/versions/airflow-env/bin/python
cachedir: .pytest_cache
rootdir: /home/ANT.AMAZON.COM/ferruzzi/workplace/airflow, configfile:
pytest.ini
plugins: anyio-3.6.2, xdist-2.5.0, forked-1.4.0, requests-mock-1.9.3,
flaky-3.7.0, instafail-0.4.2, rerunfailures-9.1.1, cov-3.0.0, timeouts-1.2.1,
httpx-0.15.0, asyncio-0.16.0
setup timeout: 0.0s, execution timeout: 0.0s, teardown timeout: 0.0s
collected 1 item
tests/providers/amazon/aws/hooks/test_s3.py::TestAwsS3HookNoMock::test_check_for_bucket_raises_error_with_invalid_conn_id
FAILED [100%]
================================================================================
FAILURES
=================================================================================
_______________________________________________
TestAwsS3HookNoMock.test_check_for_bucket_raises_error_with_invalid_conn_id
_______________________________________________
self = <tests.providers.amazon.aws.hooks.test_s3.TestAwsS3HookNoMock object
at 0x7f7d4a39c610>, monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at
0x7f7d4a39ca30>
def test_check_for_bucket_raises_error_with_invalid_conn_id(self,
monkeypatch):
monkeypatch.delenv("AWS_PROFILE", raising=False)
monkeypatch.delenv("AWS_ACCESS_KEY_ID", raising=False)
monkeypatch.delenv("AWS_SECRET_ACCESS_KEY", raising=False)
hook = S3Hook(aws_conn_id="does_not_exist")
# We're mocking all actual AWS calls and don't need a connection.
This
# avoids an Airflow warning about connection cannot be found.
hook.get_connection = lambda _: None
with pytest.raises(NoCredentialsError):
> hook.check_for_bucket("test-non-existing-bucket")
E Failed: DID NOT RAISE <class
'botocore.exceptions.NoCredentialsError'>
tests/providers/amazon/aws/hooks/test_s3.py:63: Failed
--------------------------------------------------------------------------
Captured stdout setup
--------------------------------------------------------------------------
========================= AIRFLOW ==========================
Home of the user: /home/ANT.AMAZON.COM/ferruzzi
Airflow home /home/ANT.AMAZON.COM/ferruzzi/airflow
Skipping initializing of the DB as it was initialized already.
You can re-initialize the database by adding --with-db-init flag when
running tests.
--------------------------------------------------------------------------
Captured stdout call
---------------------------------------------------------------------------
[2022-12-03 10:47:34,076] {base_aws.py:121} INFO - No connection ID
provided. Fallback on boto3 credential strategy (region_name=None). See:
https://boto3.amazonaws.com/v1/documentation/api/latest/guide/configuration.html
[2022-12-03 10:47:34,087] {credentials.py:1251} INFO - Found credentials in
shared credentials file: ~/.aws/credentials
[2022-12-03 10:47:34,593] {s3.py:221} INFO - Bucket
"test-non-existing-bucket" does not exist
----------------------------------------------------------------------------
Captured log call
----------------------------------------------------------------------------
INFO
airflow.providers.amazon.aws.hooks.base_aws.BaseSessionFactory:base_aws.py:121
No connection ID provided. Fallback on boto3 credential strategy
(region_name=None). See:
https://boto3.amazonaws.com/v1/documentation/api/latest/guide/configuration.html
INFO botocore.credentials:credentials.py:1251 Found credentials in
shared credentials file: ~/.aws/credentials
INFO airflow.providers.amazon.aws.hooks.s3.S3Hook:s3.py:221 Bucket
"test-non-existing-bucket" does not exist
============================================================================
warnings summary
=============================================================================
../../.pyenv/versions/airflow-env/lib/python3.8/site-packages/_pytest/config/__init__.py:1233
/home/ANT.AMAZON.COM/ferruzzi/.pyenv/versions/airflow-env/lib/python3.8/site-packages/_pytest/config/__init__.py:1233:
PytestConfigWarning: Unknown config option: asyncio_mode
self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
-- Docs: https://docs.pytest.org/en/stable/warnings.html
=========================================================================
short test summary info
=========================================================================
FAILED
tests/providers/amazon/aws/hooks/test_s3.py::TestAwsS3HookNoMock::test_check_for_bucket_raises_error_with_invalid_conn_id
- Failed: DID NOT RAISE <class 'botocor...
====================================================================== 1
failed, 1 warning in 1.73s
=======================================================================
(airflow-env) ferruzzi:~/workplace/airflow (main)
$
```
--
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]