Releases: descoped/fastapi-testing
Release v0.3.2
New Features
Public Headers API for AsyncTestResponse
The AsyncTestResponse class now provides a public headers property, eliminating the need to access the protected _response member for header retrieval.
Before
# Previously required accessing protected member
location = response._response.headers.get("location")After
# Clean public API
location = response.headers.get("location")Improvements
- Better API Design: Headers are now accessible through a clean, public property interface
- Consistent Error Handling: Attempting to access headers on WebSocket connections raises
InvalidResponseTypeErrorwith a clear message - Case-Insensitive Access: Headers can be accessed case-insensitively through
httpx.Headersinterface
Testing
- Added comprehensive tests for HTTP response header access
- Added tests for redirect responses with Location header
- Added WebSocket error handling tests to ensure proper exceptions are raised
Example Usage
async with create_test_server() as server:
@server.app.post("/login")
async def login_endpoint():
return Response(
status_code=302,
headers={"Location": "/dashboard"}
)
response = await server.client.post("/login", follow_redirects=False)
# Access headers directly
assert response.status_code == 302
assert response.headers["Location"] == "/dashboard"
# Case-insensitive access
location = response.headers.get("location") # Works!Breaking Changes
None - this is a backwards-compatible enhancement.
Full Changelog: v0.3.1...v0.3.2
Release v0.3.1
🚀 FastAPI Testing v0.3.1
Code Quality & Testing Enhancement Release
This release significantly improves code quality, testing coverage, and development experience while maintaining full backward compatibility.
✨ What's New
- Modern Code Formatting: Integrated [Ruff](https://github.com/astral-sh/ruff) as the primary code formatter and linter
- Comprehensive Test Coverage: Added extensive edge case and real-world scenario tests
- Enhanced CI/CD: Improved workflow reliability with better test coverage reporting
- Modern Python Syntax: Updated to Python 3.11+ type annotations throughout the codebase
🧪 Testing Improvements
- Edge Case Coverage: New tests for port exhaustion, invalid ranges, and connection failures
- WebSocket Testing: Enhanced WebSocket tests with type error handling and timeout scenarios
- Server Lifecycle: Comprehensive tests for server startup, shutdown, and error conditions
- Configuration Testing: Full coverage of environment variable handling and validation
- Concurrent Operations: Tests for multiple simultaneous connections and requests
🔧 Code Quality Enhancements
- Type Annotations: Modernized to use
list[T]instead ofList[T]syntax - Error Handling: Replaced try/except blocks with
contextlib.suppresswhere appropriate - Import Organization: Consistent import sorting and organization across all files
- Code Formatting: Standardized formatting with Ruff configuration
- Documentation: Updated with project badges and improved README
📦 Development Tools
- Ruff Integration: Comprehensive linter and formatter configuration
- CI Improvements: Enhanced GitHub Actions workflows with better test reporting
- Code Coverage: Improved coverage reporting with Codecov integration
🔄 Migration Notes
This release is fully backward compatible. No changes are required for existing users. The API remains unchanged while the internal code quality has been significantly improved.
🎯 Benefits for Contributors
- Faster Development: Automated code formatting with Ruff
- Better Testing: Comprehensive test suite covering edge cases
- Consistent Style: Enforced code style across the entire codebase
- Modern Practices: Updated to contemporary Python development standards
Release v0.3.0
🚀 FastAPI Testing v0.3.0
Major Tooling Modernization Release
This release brings significant improvements to the development workflow and build system while maintaining full backward compatibility.
✨ What's New
- Modern Package Management: Migrated from Poetry to [uv](https://github.com/astral-sh/uv) for faster dependency resolution and package management
- Automated Releases: Added GitHub Actions workflow for automated releases and publishing
- Enhanced CI/CD: New build and test workflows with coverage reporting via Codecov
- Dependency Automation: Configured Renovate bot for automated dependency updates
🔧 Technical Changes
- Build System: Switched from Poetry to hatchling with PEP 621 compliant
pyproject.toml - Lock Files: Replaced
poetry.lockwithuv.lockfor more efficient dependency resolution - Testing: Added
pytest-covfor comprehensive test coverage reporting - Project Structure: Fixed source folder structure for better package distribution
Release v0.2.2
Configuration simplification:
- Removed dependencies: pydantic-settings and python-dotenv
- Replaced with lightweight Config class with explicit env var loading
- Moved pydantic to dev dependencies only
- Improved VS Code configuration settings
Release v0.2.1
(feat) add full WebSocket support and modernize codebase.
Add comprehensive WebSocket functionality with protocol-level support and connection management.
Key changes:
- Add WebSocket testing capabilities with robust message handling
- Implement WebSocketConfig and WebSocketHelper classes
- Add retry logic and proper cleanup for WebSocket connections
- Add environment-based configuration via pydantic-settings
Release v0.2.0
(refactor) rename Test-prefixed classes to Async prefix
Rename classes prefixed with "Test" to "Async" to prevent pytest from treating them as test classes. This fixes pytest collection warnings.
- Rename TestServer to AsyncTestServer
Release v0.1.1
fix: Downgrade httpx dependency for better compatibility
- Constrain httpx version to >=0.23.0,<0.28.0 for stability
- Update documentation link to point to master branch
- Remove pytest.ini in favor of pyproject.toml configuration
Breaking changes: None
Initial Release v0.1.0
Initial release of FastAPI Testing framework with async-first design, automatic port management, and clean lifecycle management.
Includes TestServer, TestClient, and TestResponse components with full FastAPI lifespan support.
Requires Python 3.11+, FastAPI 0.115.0+
Key features:
- Async-first test framework
- Automatic port management
- Context manager support
- Built-in async HTTP client
- Resource cleanup
- Type-safe design