Subham-KRLX commented on code in PR #64012: URL: https://github.com/apache/airflow/pull/64012#discussion_r3174454839
########## .agents/skills/run-unit-tests/SKILL.md: ########## @@ -0,0 +1,110 @@ +<!-- SPDX-License-Identifier: Apache-2.0 + https://www.apache.org/licenses/LICENSE-2.0 --> + +<!-- markdownlint-disable MD022 --> +--- +name: run-unit-tests +description: Run Airflow unit tests with context-aware command selection. Uses uv on the host and breeze run inside the container. Supports targeted test paths to avoid running the full suite. +--- +<!-- markdownlint-enable MD022 --> + +Run Unit Tests +============== + +Run a targeted subset of Airflow unit tests. The correct command differs depending +on whether you are running on the **host** or inside a **Breeze** container. + +Source of truth for test workflow semantics is `contributing-docs`; this skill maps +that guidance into context-aware host/Breeze command execution. + +Context Detection +----------------- + +Check for the Docker container marker before choosing a command: + +```bash +# You are inside Breeze if this file exists: +ls /.dockerenv +``` + +| Context | Detection | Command | +|---|---|---| +| **Host** | `/.dockerenv` absent | `uv run --project <PROJECT> pytest <path>` | +| **Breeze** | `/.dockerenv` present | `breeze run pytest <path>` | + +You can also call `python scripts/ci/prek/breeze_context.py` to auto-detect and +print `host` or `breeze`. + +Commands +-------- + +On the Host +----------- + +`<PROJECT>` is the folder containing the relevant `pyproject.toml`, e.g. +`airflow-core`, `providers/amazon`, `task-sdk`, `scripts`. + +```bash +# Run a single test method +uv run --project <PROJECT> pytest path/to/test.py::TestClass::test_method -xvs + +# Run all tests in a file +uv run --project <PROJECT> pytest path/to/test.py -xvs + +# Run all tests in a package +uv run --project <PROJECT> pytest path/to/package/ -xvs + +# If uv fails due to missing system dependencies, fall back to Breeze: +breeze testing core-tests --run-in-parallel +``` + +Inside Breeze +------------- + +```bash +# Run a single test method +breeze run pytest path/to/test.py::TestClass::test_method -xvs + +# Run all tests in a file +breeze run pytest path/to/test.py -xvs + +# Run Breeze's built-in parallel test runners +breeze testing core-tests --run-in-parallel +breeze testing providers-tests --run-in-parallel +``` + +Workflow Context +---------------- + +This is **Scenario 2** of the standard Airflow contributor workflow: + +1. stage-changes +2. run-static-checks +3. → **run-unit-tests** (this skill) + +Run static checks first to avoid failing tests due to trivial formatting issues. + +Prerequisites +------------- + +- **Host:** `uv` must be installed and the project synced. +- **Breeze:** Docker must be running and the Breeze image built. Start a Breeze Review Comment: Agreed. -- 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]
