Smithery Logo
MCPsSkillsDocsPricing
Login
Smithery Logo

Accelerating the Agent Economy

Resources

DocumentationPrivacy PolicySystem Status

Company

PricingAboutBlog

Connect

© 2026 Smithery. All rights reserved.

    jawad-chaudhary

    pytest-testing

    jawad-chaudhary/pytest-testing
    Coding

    About

    SKILL.md

    Install

    Install via Skills CLI

    or add to your agent
    • Claude Code
      Claude Code
    • Codex
      Codex
    • OpenClaw
      OpenClaw
    • Cursor
      Cursor
    • Amp
      Amp
    • GitHub Copilot
      GitHub Copilot
    • Gemini CLI
      Gemini CLI
    • Kilo Code
      Kilo Code
    • Junie
      Junie
    • Replit
      Replit
    • Windsurf
      Windsurf
    • Cline
      Cline
    • Continue
      Continue
    • OpenCode
      OpenCode
    • OpenHands
      OpenHands
    • Roo Code
      Roo Code
    • Augment
      Augment
    • Goose
      Goose
    • Trae
      Trae
    • Zencoder
      Zencoder
    • Antigravity
      Antigravity
    ├─
    ├─
    └─

    About

    Async testing with pytest, pytest-asyncio, httpx, fixtures, coverage reports, and test-first development. Use when writing tests, test fixtures, or measuring coverage.

    SKILL.md

    Pytest Async Testing

    Configuration (pytest.ini)

    [pytest]
    asyncio_mode = auto
    testpaths = tests
    addopts = --cov=. --cov-report=html --cov-report=term-missing --cov-fail-under=80
    

    Fixtures (conftest.py)

    import pytest
    import pytest_asyncio
    from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession
    from httpx import AsyncClient
    
    @pytest_asyncio.fixture
    async def db_session():
        engine = create_async_engine("sqlite+aiosqlite:///:memory:")
        async with engine.begin() as conn:
            await conn.run_sync(SQLModel.metadata.create_all)
        async_session = sessionmaker(engine, class_=AsyncSession)
        async with async_session() as session:
            yield session
        await engine.dispose()
    
    @pytest_asyncio.fixture
    async def client():
        async with AsyncClient(app=app, base_url="http://test") as ac:
            yield ac
    
    @pytest.fixture
    def auth_token():
        return generate_test_token("test_user")
    

    Async Tests

    @pytest.mark.asyncio
    async def test_endpoint(client, auth_token):
        response = await client.post(
            "/api/user123/chat",
            json={"message": "Add task"},
            headers={"Authorization": f"Bearer {auth_token}"}
        )
        assert response.status_code == 200
        data = response.json()
        assert "conversation_id" in data
    

    Coverage

    pytest --cov=. --cov-report=html  # Generate HTML report
    pytest --cov=. --cov-report=term-missing  # Show missing lines
    pytest --cov-fail-under=80  # Fail if below 80%
    

    Test-First Pattern

    1. Write test defining expected behavior
    2. Run test (should fail)
    3. Implement code to pass test
    4. Refactor while keeping tests green
    Recommended Servers
    Postman
    Postman
    Vercel Grep
    Vercel Grep
    OpenZeppelin
    OpenZeppelin
    Repository
    jawad-chaudhary/hackathone-2-todo-spec-driven-development
    Files