The `pool_executor/` directory contains all tests related to the `pool_executors` package, which provides executor pool extensions including serial execution support.
### Why a Separate Directory?
1.**Package Isolation**: The `pool_executors` package is designed as a standalone package that could be extracted from this repository in the future. Keeping its tests in a dedicated directory mirrors this separation.
1.**Clear Ownership**: Tests for executor functionality are clearly grouped together, making it easier to find and maintain them.
1.**Import Clarity**: When working on pool executor tests, imports use the package path `pool_executors.pool_executors` rather than `tdoc_crawler` imports, reinforcing the package's independence.
### Test Files
-**test_executor_adapter.py**: Tests for the `Runner` class that provides aiointerpreters-compatible API using pool_executors
-**test_serial_executor.py**: Comprehensive tests for `SerialPoolExecutor`, `SerialFuture`, and the `create_executor` factory
### Running Pool Executor Tests
```bash
# Run all pool executor tests
uv run pytest tests/pool_executor/ -v
# Run specific test file
uv run pytest tests/pool_executor/test_serial_executor.py -v
# Run with coverage
uv run pytest tests/pool_executor/ --cov=pool_executors --cov-report=term-missing
```
### Coverage Target
Pool executor tests should maintain **>90% code coverage** to ensure reliability of this core component.
## Adding New Tests
### For Pool Executor Features
When adding new features to the `pool_executors` package:
1. Add tests to `tests/pool_executor/test_serial_executor.py` for SerialPoolExecutor changes
1. Add tests to `tests/pool_executor/test_executor_adapter.py` for Runner adapter changes
1. Ensure all new tests follow the existing patterns:
- Use pytest
- Include docstrings
- Test both success and failure cases
- Aim for comprehensive coverage
### For Other Features
Follow the existing pattern in the appropriate test file in `tests/`. If adding a substantial new feature, consider creating a new test file in the appropriate location.
## Test Fixtures
Shared fixtures are defined in `conftest.py`. Key fixtures include:
-`test_db_path`: Path to test database
-`credentials`: Mock PortalCredentials for testing