Parkerhiphop commented on code in PR #58765: URL: https://github.com/apache/airflow/pull/58765#discussion_r2567701618
########## contributing-docs/testing/unit_tests.rst: ########## @@ -20,48 +20,41 @@ Airflow Unit Tests All unit tests for Apache Airflow are run using `pytest <http://doc.pytest.org/en/latest/>`_. -**The outline for this document in GitHub is available at top-right corner button (with 3-dots and 3 lines).** +**The outline for this document in GitHub is available via the button in the top-right corner (icon with 3 dots and 3 lines).** Writing Unit Tests ------------------ -Follow the guidelines when writing unit tests: +Follow these guidelines when writing unit tests: -* For standard unit tests that do not require integrations with external systems, make sure to simulate all communications. -* All Airflow tests are run with ``pytest``. Make sure to set your IDE/runners (see below) to use ``pytest`` by default. -* For tests, use standard "asserts" of Python and ``pytest`` decorators/context managers for testing - rather than ``unittest`` ones. See `pytest docs <http://doc.pytest.org/en/latest/assert.html>`__ for details. -* Use a ``pytest.mark.parametrize`` marker for tests that have variations in parameters. - See `pytest docs <https://docs.pytest.org/en/latest/how-to/parametrize.html>`__ for details. -* Use with ``pytest.warn`` to capture warnings rather than ``recwarn`` fixture. We are aiming for 0-warning in our - tests, so we run Pytest with ``--disable-warnings`` but instead we have custom warning capture system. +* For standard unit tests that do not require integration with external systems, ensure all communications are simulated (mocked). +* All Airflow tests are run with ``pytest``. Ensure your IDE or runners (see below) are configured to use ``pytest`` by default. +* For tests, use standard Python "asserts" and ``pytest`` decorators/context managers for testing rather than ``unittest`` ones. See `pytest docs <http://doc.pytest.org/en/latest/assert.html>`__ for details. +* Use the ``pytest.mark.parametrize`` marker for tests that have variations in parameters. See `pytest docs <https://docs.pytest.org/en/latest/how-to/parametrize.html>`__ for details. +* Use ``pytest.warns`` to capture warnings instead of the ``recwarn`` fixture. We aim for zero warnings in our tests; therefore, we run pytest with ``--disable-warnings`` and utilize a custom warning capture system. Handling warnings ................. -By default, in the new tests selected warnings are prohibited: +By default, specific warnings are prohibited in new tests: * ``airflow.exceptions.AirflowProviderDeprecationWarning`` -That mean if one of this warning appear during test run and do not captured the test will failed. +Any test triggering this warning without capturing it will fail. Review Comment: Make it easier to understand. -- 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]
