potiuk commented on PR #68533: URL: https://github.com/apache/airflow/pull/68533#issuecomment-4704756093
Thanks @kaxil — all three make this much smaller, applied them: **`client=` on `start()`** — `InProcessTestSupervisor.start()` and `run_task_in_process()` now take an optional `client=`, defaulting to `cls._api_client(task.dag)` as before. `run_task_no_db` injects an in-memory client through it, so the per-call subclass is gone on `main`. (For released Task SDKs that have `InProcessTestSupervisor` but not the param yet, it falls back to overriding `_api_client` — kept only as a version-compat shim.) **Reuse the dry-run client** — dropped the three `_Stub*` classes. It's now a real `Client(dry_run=True)` whose `MockTransport` does exactly the "remembers writes" bit you described: round-trips XCom from an in-memory dict, delegating everything else to `noop_handler`. (I do replay the run-context explicitly rather than rely on `noop_handler`'s — its fake `TIRunContext` no longer validates against the live schema.) Since it's a real client, there's no `MagicMock`/`__getattr__` fallback anymore, so the "passes against a mock" footgun is gone too. **`TaskRunResult`** — `run_task_no_db` now returns the stock `TaskRunResult` plus the pushed-XCom dict; `TaskRunResultNoDB` is removed. Compat: on Airflow 2.x (no `InProcessTestSupervisor`) the venv classes fall back to the DB path and keep `db_test`. --- Drafted-by: Claude Code (Opus 4.8); reviewed by @potiuk before posting -- 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]
