potiuk opened a new pull request, #68533:
URL: https://github.com/apache/airflow/pull/68533

   `PythonVirtualenvOperator` / `ExternalPythonOperator` tests dominate the 
`Providers[standard]` suite (~450s of ~510s) because they build real 
virtualenvs, yet they were forced to run **serially**: they were marked 
`db_test`, so pytest-xdist could not parallelize them.
   
   Their only real DB coupling was the test harness, not the metadata DB — but 
the venv subprocess reconnects to the supervisor over a socket, so they can't 
use the plain `run_task` mock (no real socket → `OSError: Socket operation on 
non-socket`).
   
   This adds `tests_common.test_utils.in_process_taskrun.run_task_no_db`, which 
drives `InProcessTestSupervisor`'s **real socketpair** with an **in-memory stub 
Execution-API client** — so a venv operator runs with a working supervisor 
socket and no metadata DB. `TestPythonVirtualenvOperator` and 
`TestExternalPythonOperator` are converted onto it via a `_DBFreeVenvRun` mixin 
and **drop their `db_test` mark**, so they parallelize under `--skip-db-tests 
--use-xdist`. The module-level `db_test`/`need_serialized_dag` mark moves to 
the remaining DB classes; branch venv classes keep `db_test` (their multi-task 
state assertions need a real DAG run).
   
   **Measured:** the two classes run ~3× faster at `-n 4` (157 tests, 89s vs 
~266s serial); larger gains at CI worker counts. Validated DB-free runs 
(External 43, Virtualenv 114, 0 failures) and confirmed no regression in the 
remaining DB classes.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Opus 4.8)
   
   Generated-by: Claude Code (Opus 4.8) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)


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