phanikumv commented on code in PR #32669:
URL: https://github.com/apache/airflow/pull/32669#discussion_r1266862824
##########
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,
Review Comment:
```suggestion
``AIRFLOW_HOME/unittest.cfg``. The template for it was stored in
"config_templates" next to the yaml file,
```
##########
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:
Can you please mention which file has been overwritten for more clarity.
##########
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
Review Comment:
```suggestion
fixture. This in turn makes airflow load test configuration from
```
##########
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,
Review Comment:
```suggestion
however this was only done for the first time you run airflow and you had
to manually maintain the file.
```
##########
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
Review Comment:
```suggestion
We are in the process of converting all unit tests to standard "asserts"
and pytest fixtures
```
##########
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:
```suggestion
It was pretty arcane knowledge, and this file has been overwritten in
Breeze environment
```
--
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]