feat: improve async testing infrastructure and fix coroutine warnings (issue #84)

## Key Improvements:

### Enhanced Test Configuration
- Add pytest-asyncio with auto mode for better async test support
- Remove manual event loop fixture in favor of pytest-asyncio management
- Configure proper asyncio mode in pytest.ini

### New Async Test Utilities
- Add AsyncTestCase base class for automatic mock cleanup
- Add create_async_mock_that_returns/raises helper functions
- Add cleanup_async_mocks function to prevent resource warnings
- Add async_cleanup fixture for test-scoped mock management

### Fixed Coroutine Warnings
- Update TestGiteaPluginListIssues to inherit from AsyncTestCase
- Replace problematic AsyncMock usage with managed async mocks
- Mock async methods directly on plugin instances to avoid creating real coroutines
- Significantly reduced coroutine warnings in test_issue_59_gitea_plugin.py

### Results
- Reduced coroutine warnings from 11+ to ~3 remaining (75%+ improvement)
- All existing tests continue to pass
- Better async test patterns established for future development
- Proper resource cleanup prevents memory leaks in test runs

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-04 02:33:48 +02:00
parent a657995fc6
commit 38d9c5ca80
4 changed files with 136 additions and 19 deletions

View File

@@ -9,6 +9,7 @@ addopts =
-ra
testpaths = tests
norecursedirs = .markitect_workspace .git __pycache__ .pytest_cache
asyncio_mode = auto
python_files = test_*.py *_test.py
python_classes = Test*
python_functions = test_*