nuclearpinguin commented on a change in pull request #6472: [AIRFLOW-6058] Running tests with pytest URL: https://github.com/apache/airflow/pull/6472#discussion_r352247777
########## File path: BREEZE.rst ########## @@ -506,40 +506,47 @@ capturing the stdout of your process. Running Unit Tests in Airflow Breeze ------------------------------------ -Once you enter Airflow Breeze environment, you can simply use -``run-tests`` at will. Note that if you want to pass extra parameters to ``nose``, -you should do it after '--'. +Once you enter Airflow Breeze environment, you can simply use +`pytest <http://doc.pytest.org/en/latest/>`_ at will. +The tests run ``airflow db init`` and ``airflow db reset`` the first time you launch them in a running +container, so you can count on the database being initialized. -For example, to execute the "core" unit tests, run the following: +All subsequent test executions within the same container will run without database +initialization. + +You can also optionally add the ``--with-db-init`` flag if you want to re-initialize +the database. .. code-block:: bash - run-tests tests.core:TestCore -- -s --logging-level=DEBUG + pytest --with-db-init tests/test_core.py::TestCore::test_check_operators -s --logging-level=DEBUG -For a single test method, run: +There are many available options for selecting specific test in pytest. Details could be found +in official documentation but here are few basic examples: .. code-block:: bash - run-tests tests.core:TestCore.test_check_operators -- -s --logging-level=DEBUG + pytest -k "TestCore and not check" Review comment: As described below: "The example above will run ``TestCore.test_bash_operator_kill`` but not ``TestCore.test_check_operators``." If that's still unclear I can link there one more time to pytest documentation, WDYT? ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
