mirror of
https://github.com/Second-Hand-Friends/kleinanzeigen-bot.git
synced 2026-03-12 10:31:50 +01:00
* test: implement comprehensive test coverage improvements This commit improves test coverage across multiple modules, adding unit tests for core functionality. Key improvements: 1. WebScrapingMixin: - Add comprehensive async error handling tests - Add session management tests (browser crash recovery, session expiration) - Add element interaction tests (custom wait conditions, timeouts) - Add browser configuration tests (extensions, preferences) - Add robust awaitable mocking infrastructure - Rename integration test file to avoid naming conflicts 2. Error Handlers: - Add tests for error message formatting - Add tests for error recovery scenarios - Add tests for error logging functionality 3. Network Utilities: - Add tests for port checking functionality - Add tests for network error handling - Add tests for connection management 4. Pydantic Models: - Add tests for validation cases - Add tests for error handling - Add tests for complex validation scenarios Technical details: - Use TrulyAwaitableMockPage for proper async testing - Add comprehensive mocking for browser and page objects - Add proper cleanup in session management tests - Add browser-specific configuration tests (Chrome/Edge) - Add proper type hints and docstrings Files changed: - Renamed: tests/integration/test_web_scraping_mixin.py → tests/integration/test_web_scraping_mixin_integration.py - Added: tests/unit/test_error_handlers.py - Added: tests/unit/test_net.py - Added: tests/unit/test_pydantics.py - Added: tests/unit/test_web_scraping_mixin.py * test: enhance test coverage with additional edge cases and scenarios This commit extends the test coverage improvements with additional test cases and edge case handling, focusing on browser configuration, error handling, and file utilities. Key improvements: 1. WebScrapingMixin: - Add comprehensive browser binary location detection tests - Add cross-platform browser path detection (Linux, macOS, Windows) - Add browser profile configuration tests - Add session state persistence tests - Add external process termination handling - Add session creation error cleanup tests - Improve browser argument configuration tests - Add extension loading validation tests 2. Error Handlers: - Add debug mode error handling tests - Add specific error type tests (AttributeError, ImportError, NameError, TypeError) - Improve error message formatting tests - Add traceback inclusion verification 3. Pydantic Models: - Add comprehensive validation error message tests - Add tests for various error codes and contexts - Add tests for pluralization in error messages - Add tests for empty error list handling - Add tests for context handling in validation errors 4. File Utilities: - Add comprehensive path resolution tests - Add tests for file and directory reference handling - Add tests for special path cases - Add tests for nonexistent path handling - Add tests for absolute and relative path conversion Technical details: - Add proper type casting for test fixtures - Improve test isolation and cleanup - Add platform-specific browser path detection - Add proper error context handling - Add comprehensive error message formatting tests - Add proper cleanup in session management tests - Add browser-specific configuration tests - Add proper path normalization and resolution tests * fix(test): handle Linux browser paths in web_scraping_mixin test Update mock_exists to properly detect Linux browser binaries in test_browser_profile_configuration, fixing the "Installed browser could not be detected" error. * fix(test): handle Windows browser paths in web_scraping_mixin test Add Windows browser paths to mock_exists function to properly detect browser binaries on Windows platform, fixing the "Specified browser binary does not exist" error.
40 KiB
40 KiB