davidcastagnetoa/skills

pytest_asyncio

Framework de testing con soporte completo para código async, fixtures y parametrización

First seen Mar 6, 2026

Installation

$ npx skills add davidcastagnetoa/skills --skill pytest_asyncio

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from davidcastagnetoa/skills · top by installs.

npx skills add davidcastagnetoa/skills

Browse all from davidcastagnetoa/skills

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Stars 1
Default branch main
Open issues 0
Status Active

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 2,254 B
  • docs SUMMARY.md 111 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 5 installs

SKILL.md

pytest_asyncio

pytest es el framework de testing principal del sistema KYC. pytest-asyncio añade soporte para tests de funciones async def, indispensable dado que todos los agentes son async. pytest-cov mide la cobertura de tests.

When to use

Usar para todos los tests: unitarios, de integración y de regresión. Ningún código nuevo debe llegar a main sin tests que cubran el happy path y los edge cases críticos.

Instructions

  1. Instalar: pip install pytest pytest-asyncio pytest-cov httpx
  2. Configurar en pyproject.toml:

``toml [tool.pytest.inioptions] asynciomode = "auto" testpaths = ["backend/tests"] addopts = "--cov=backend --cov-report=xml --cov-fail-under=80" ``

  1. Estructura de tests:

`` backend/tests/ ├── unit/ │ ├── testlivenessagent.py │ ├── testocragent.py │ └── testfacematchagent.py ├── integration/ │ ├── testpipelinee2e.py │ └── testapi_endpoints.py └── conftest.py ``

  1. Test async example:

``python import pytest from httpx import AsyncClient from backend.main import app @pytest.mark.asyncio async def testverifyendpointreturns200(): async with AsyncClient(app=app, baseurl="http://test";) as client: response = await client.post("/v1/verify", json={"sessionid": "test-123"}) assert response.status_code == 200 ``

  1. Fixtures en conftest.py: mock de modelos ML (devolver scores fijos), conexión a Redis de test, factory de sesiones.
  2. Tests críticos obligatorios: threshold de liveness, threshold de face match, rechazo de documento expirado, rate limiting.

Notes

  • asyncio_mode = "auto" hace que todos los tests async se ejecuten sin @pytest.mark.asyncio en cada función.
  • Mockear los modelos ML con pytest-mock o unittest.mock para tests unitarios rápidos — los tests con modelos reales van en tests de integración.
  • httpx.AsyncClient permite testear endpoints FastAPI sin levantar un servidor real.