Files
markitect-main/pytest.ini
tegwick 38d9c5ca80 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>
2025-10-04 02:33:48 +02:00

31 lines
1003 B
INI

[pytest]
addopts =
--strict-markers
--strict-config
--verbose
--tb=short
--durations=10
--maxfail=3
-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_*
markers =
slow: marks tests as slow (deselect with '-m "not slow"')
integration: marks tests as integration tests
e2e: marks tests as end-to-end tests
performance: marks tests as performance tests
unit: marks tests as unit tests
smoke: marks tests as smoke tests for quick validation
asyncio: marks tests as async tests
timeout(seconds): marks tests with custom timeout duration
arch: marks tests as architecture tests
fast: marks tests as fast execution tests (for TDD red phase)
filterwarnings =
log_cli = true
log_cli_level = INFO
log_cli_format = %(asctime)s [%(levelname)8s] %(name)s: %(message)s
log_cli_date_format = %Y-%m-%d %H:%M:%S