Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pytest from working outside breeze #43082

Merged
merged 1 commit into from
Oct 16, 2024
Merged

Commits on Oct 16, 2024

  1. Fix pytest from working outside breeze

    This was missed in apache#42985 . Without this `airflow.providers.__path__` had 2 registered paths:
    
    ```
    ['/Users/kaxilnaik/Documents/GitHub/astronomer/airflow/providers/src/airflow/providers',
     '/Users/kaxilnaik/Documents/GitHub/astronomer/airflow/providers']
    ```
    
    This prevents the tests from running outside of breeze and we get the following error:
    
    ```
    ERROR tests/core/test_settings.py::test_usage_data_collection_disabled[true-True-True] - airflow.exceptions.AirflowConfigException: ("The provider apache-airflow-providers-src-airflow-providers-amazon is attempting to contribute configuration section aws that has already been added before. The source of it: apache-airflow-providers-amazon. This is forbidden. A provider can only add new sections. It cannot contribute options to existing sections or override other provider's configuration.", <class 'UserWarning'>)
    ```
    
    We get this error because the *Providers Manager* uses `airflow.providers.__path__` to register providers. Because we have 2 paths, it registers the same provider twice leading two the above error.
    
    https://github.com/apache/airflow/blob/75b22940ac4d36c31380669da2aa32fe46d70d32/airflow/providers_manager.py#L662
    
    Example registration:
    ```
    ('apache-airflow-providers-src-airflow-providers-yandex',
      {'yandex': {'description': 'This section contains settings for Yandex Cloud ', ...
    
    ('apache-airflow-providers-yandex',
      {'yandex': {'description': 'This section contains settings for Yandex Cloud '
    ```
    
    This wasn't a problem in breeze as it sets `AIRFLOW_SOURCES` env var in Dockerfile
    https://github.com/apache/airflow/blob/75b22940ac4d36c31380669da2aa32fe46d70d32/scripts/docker/entrypoint_ci.sh#L24
    kaxil committed Oct 16, 2024
    Configuration menu
    Copy the full SHA
    33dbbfd View commit details
    Browse the repository at this point in the history