potiuk commented on code in PR #40205:
URL: https://github.com/apache/airflow/pull/40205#discussion_r1639253344
##########
contributing-docs/testing/unit_tests.rst:
##########
@@ -1440,6 +1440,29 @@ to **ignore**, e.g. set ``PYTHONWARNINGS`` environment
variable to ``ignore``.
pytest tests/core/ --disable-capture-warnings
+Keep tests using environment variables
+......................................
+
+By default, all environment variables related to Airflow (starting by
``AIRFLOW__``) are all cleared before running tests
+to avoid potential side effect. However, in some scenarios you might want to
disable this mechanism and keep the
+environment variables you defined to configure your Airflow environment. For
example, you might want to run tests
+against a specific database configured through the environment variable
``AIRFLOW__DATABASE__SQL_ALCHEMY_CONN``.
+Or running tests using a specific executor to run tasks configured through
``AIRFLOW__CORE__EXECUTOR``.
+
+To keep using environment variables you defined in your environment, you need
to provide ``--keep-env-variables`` as
+pytest CLI argument.
+
+.. code-block:: bash
+
+ pytest tests/core/ --disable-capture-warnings
Review Comment:
```suggestion
pytest tests/core/ --keep-env-variables
```
And. below too :)
--
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]