chore: block asyncio marks in tests (#2744)

# What does this PR do?

use pre-commit to block addition of new asyncio marks, since we
configure pytest with async-mode=auto, see
https://github.com/meta-llama/llama-stack/pull/2730
This commit is contained in:
Matthew Farrellee 2025-07-17 19:33:30 -04:00 committed by GitHub
parent bd8a3ae3cc
commit 910b017680
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -129,6 +129,22 @@ repos:
require_serial: true
always_run: true
files: ^llama_stack/.*$
- id: forbid-pytest-asyncio
name: Block @pytest.mark.asyncio and @pytest_asyncio.fixture
entry: bash
language: system
types: [python]
pass_filenames: true
args:
- -c
- |
grep -EnH '^[^#]*@pytest\.mark\.asyncio|@pytest_asyncio\.fixture' "$@" && {
echo;
echo "❌ Do not use @pytest.mark.asyncio or @pytest_asyncio.fixture."
echo " pytest is already configured with async-mode=auto."
echo;
exit 1;
} || true
ci:
autofix_commit_msg: 🎨 [pre-commit.ci] Auto format from pre-commit.com hooks