Spaces:
Build error
Build error
|
Download docs/contributing/testing.md from DataQuests/DeepCritical: direct link, hf CLI and curl.
- Browser
- Download file 1.42 kB
-
https://huggingface.co/spaces/DataQuests/DeepCritical/resolve/b2efdc172e4a5f2f2d694bc5585d6f39a233a2bd/docs/contributing/testing.md
- Command line
-
hf download hf://spaces/DataQuests/DeepCritical@b2efdc172e4a5f2f2d694bc5585d6f39a233a2bd/docs/contributing/testing.md
-
curl -L -o testing.md https://huggingface.co/spaces/DataQuests/DeepCritical/resolve/b2efdc172e4a5f2f2d694bc5585d6f39a233a2bd/docs/contributing/testing.md
1.42 kB
Testing Requirements
This document outlines testing requirements and guidelines for DeepCritical.
Test Structure
- Unit tests in
tests/unit/(mocked, fast) - Integration tests in
tests/integration/(real APIs, marked@pytest.mark.integration) - Use markers:
unit,integration,slow
Mocking
- Use
respxfor httpx mocking - Use
pytest-mockfor general mocking - Mock LLM calls in unit tests (use
MockJudgeHandler) - Fixtures in
tests/conftest.py:mock_httpx_client,mock_llm_response
TDD Workflow
- Write failing test in
tests/unit/ - Implement in
src/ - Ensure test passes
- Run
make check(lint + typecheck + test)
Test Examples
@pytest.mark.unit
async def test_pubmed_search(mock_httpx_client):
tool = PubMedTool()
results = await tool.search("metformin", max_results=5)
assert len(results) > 0
assert all(isinstance(r, Evidence) for r in results)
@pytest.mark.integration
async def test_real_pubmed_search():
tool = PubMedTool()
results = await tool.search("metformin", max_results=3)
assert len(results) <= 3
Test Coverage
- Run
make test-covfor coverage report - Aim for >80% coverage on critical paths
- Exclude:
__init__.py,TYPE_CHECKINGblocks
See Also
- Code Style - Code style guidelines
- Implementation Patterns - Common patterns