This directory contains the main DeepWiki test suite, organized by type and scope. The repository also has a legacy test/ directory with focused regression tests.
tests/
|-- unit/ # Unit tests - test individual components in isolation
| |-- test_google_embedder.py
| `-- test_all_embedders.py
|-- integration/ # Integration tests - test component interactions
| `-- test_full_integration.py
|-- api/ # API tests - test HTTP endpoints
| `-- test_api.py
`-- run_tests.py # Category-based test runner script
test/
`-- test_extract_repo_name.py # Legacy focused regression tests
pytest.ini is configured to discover tests from both tests/ and the legacy test/ directory.
python -m pytestIf you are using the Poetry environment from api/pyproject.toml without activating it, run pytest from the repository root with explicit paths:
poetry -C api run python -m pytest ../tests ../testpython -m pytest testspython -m pytest testpython tests/run_tests.pypython tests/run_tests.py --unitpython tests/run_tests.py --integrationpython tests/run_tests.py --api# Unit tests
python -m pytest tests/unit/test_google_embedder.py
python -m pytest tests/unit/test_all_embedders.py
# Integration tests
python -m pytest tests/integration/test_full_integration.py
# API tests
python -m pytest tests/api/test_api.py
# Legacy focused tests
python -m pytest test/test_extract_repo_name.pyGOOGLE_API_KEY: Required for Google AI embedder testsOPENAI_API_KEY: Required for some integration testsDEEPWIKI_EMBEDDER_TYPE: Set togooglefor Google embedder tests
Install the Python dependencies from the project root:
python -m pip install poetry==2.0.1
poetry install -C apiThe test dependencies are declared in api/pyproject.toml.
- Purpose: Test individual components in isolation
- Speed: Fast
- Dependencies: Minimal external dependencies
- Examples: Embedder response parsing and configuration loading
- Purpose: Test how components work together
- Speed: Medium
- Dependencies: May require API keys and external services
- Examples: End-to-end embedding pipeline and RAG workflow
- Purpose: Test HTTP endpoints and WebSocket connections
- Speed: Medium-slow
- Dependencies: Requires a running API server
- Examples: Chat completion endpoints and streaming responses
- Choose the right category: unit, integration, API, or focused regression.
- Place main suite tests under
tests/and legacy focused regression tests undertest/only when matching existing coverage. - Follow the naming convention:
test_<component_name>.py. - Add the project root to
sys.pathwhen needed. - Add docstrings or clear test names explaining what the test covers.
- Update this README when adding new test files or commands.
If you get import errors, ensure the test file includes the project root path setup:
from pathlib import Path
import sys
project_root = Path(__file__).parent.parent.parent
sys.path.insert(0, str(project_root))For tests directly under test/, adjust the parent traversal accordingly.
Make sure you have a .env file in the project root with the required API keys:
GOOGLE_API_KEY=your_google_api_key_here
OPENAI_API_KEY=your_openai_api_key_here
DEEPWIKI_EMBEDDER_TYPE=googleFor API tests, ensure the FastAPI server is running on the expected port:
python -m api.main