potiuk commented on code in PR #32669:
URL: https://github.com/apache/airflow/pull/32669#discussion_r1267151003


##########
TESTING.rst:
##########
@@ -55,8 +55,36 @@ Follow the guidelines when writing unit tests:
   tests, so we run Pytest with ``--disable-warnings`` but instead we have 
``pytest-capture-warnings`` plugin that
   overrides ``recwarn`` fixture behaviour.
 
-**NOTE:** We plan to convert all unit tests to standard "asserts" 
semi-automatically, but this will be done later
-in Airflow 2.0 development phase. That will include setUp/tearDown/context 
managers and decorators.
+
+.. note::
+
+  We are in the process of convert all unit tests to standard "asserts" and 
pytest fixtures
+  so if you find some tests that are still using classic setUp/tearDown 
approach or unittest asserts, feel
+  free to convert them to pytest.
+
+Airflow configuration for unit tests
+------------------------------------
+
+Some of the unit tests require special configuration set as the ``default``. 
This is done automatically by
+adding ``AIRFLOW__CORE__UNIT_TEST_MODE=True`` to the environment variables in 
Pytest auto-used
+fixture. This in turn makes airflow configuration load test configuration from
+``airflow/config_templates/unit_tests.cfg`` - the test configuration from 
there replaces the original
+defaults from ``airflow/config_templates/config.yml``. If you want to add some 
test-only configuration,
+as default for all tests you should add the value to this file.
+
+You can also of course override the values in individual test by patching 
environment variables following
+the usual ``AIRFLOW__SECTION__KEY`` pattern or ``conf_vars`` context manager.
+
+.. note::
+
+  The test configuration for Airflow before July 2023 was automatically 
generated in a file named
+  ``AIRFLOW_HOME/unittest.cfg`` and template for it was stored in 
"config_templates" next to the yaml file,
+  however this was only done for the first time you run airflow and you had to 
manually maintain the file,
+  and it was pretty arcane knowledge, also this file has been overwritten in 
Breeze environment

Review Comment:
   Yeah. good point.



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