ChickenBenny opened a new pull request, #77628: URL: https://github.com/apache/airflow/pull/77628
AGENTS.md says to use `conf_vars` as a decorator when the value is fixed. Followed literally in an `async def` test, that breaks the test. `conf_vars` is a `contextlib.contextmanager`, so as a decorator it wraps the test in a plain sync function. pytest-asyncio then no longer sees a coroutine function, and pytest fails the test with `async def functions are not natively supported`. The test body never runs. In an async test, `conf_vars` only works as a `with` block inside the body. The rule also listed `@pytest.mark.parametrize` as the only reason to use the context manager. A value that is only known at run time, such as one built from `tmp_path`, cannot go in a decorator either. `mock.patch` is not affected, because it detects coroutine functions, so the `@mock.patch` guidance in the same bullet stays as it is. ### Validation - A minimal pytest-asyncio test, with a `contextlib.contextmanager` used as a decorator on an `@pytest.mark.asyncio` test, fails with `async def functions are not natively supported`. The same context manager as a `with` block inside the body passes. - `prek run run-skill-eval --hook-stage manual --all-files` (Claude Sonnet 4.6) gave the same result on `main` and on this branch for all 6 cases. The 2 cases that fail fail on `main` too. No case covers `conf_vars`, so the eval only shows that nothing else changed. --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes — Claude Code (Opus 5.5) Generated-by: Claude Code (Opus 5.5) 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]
