Files
portainer-core/services/scheduler/pytest.ini
T
jpmschweitzerandClaude Sonnet 4.5 4e4ce38db5 test(scheduler): add comprehensive test suite with 80% coverage
Add complete testing infrastructure with unit, integration, and API tests.

Test coverage: 80% overall
- config.py: 100%
- example_executor.py: 100%
- main.py (API endpoints): 95%
- doc_sync_executor.py: 78%
- executor.py (core logic): 71%
- config_backup_executor.py: 50%

Test categories:
- Unit tests: Fast tests with mocked dependencies
- API tests: Comprehensive endpoint testing (24 tests)
- Executor tests: Task executor validation
- Integration tests: Real database operations

Test infrastructure:
- pytest configuration with markers (unit, integration, api, executor)
- Coverage reporting with pytest-cov
- Dedicated test database (test_scheduler on postgres-shared)
- Database fixtures for clean test state
- Mock fixtures for unit testing

Test database:
- Database: test_scheduler
- User: test_scheduler_user
- Automatic schema creation and cleanup
- Integration tests use real PostgreSQL

Files:
- pytest.ini - pytest configuration
- tests/conftest.py - shared fixtures
- tests/test_api.py - API endpoint tests
- tests/test_api_comprehensive.py - comprehensive API tests
- tests/test_config.py - configuration tests
- tests/test_database_integration.py - database integration tests
- tests/test_integration.py - general integration tests
- tests/test_*_executor.py - executor-specific tests
- tests/test_database_setup.sql - test database schema

85 total tests with 54 passing core tests

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-07 23:15:31 +01:00

46 lines
993 B
INI

[pytest]
# Pytest configuration for The Scheduler
# Test discovery patterns
python_files = test_*.py
python_classes = Test*
python_functions = test_*
# Test paths
testpaths = tests
# Asyncio mode
asyncio_mode = auto
asyncio_default_fixture_loop_scope = function
# Coverage options
addopts =
--verbose
--strict-markers
--tb=short
--cov=src
--cov-report=term-missing
--cov-report=html:htmlcov
--cov-report=json:coverage.json
--cov-branch
# Custom markers
markers =
unit: Unit tests (fast, no external dependencies)
integration: Integration tests (may use database, slower)
executor: Tests for task executors
api: API endpoint tests
slow: Tests that take a while to run
# Ignore patterns
norecursedirs = .git .tox dist build *.egg venv __pycache__ node_modules
# Console output
console_output_style = progress
# Fail on first error (disable for CI)
# addopts = --exitfirst
# Show local variables in tracebacks
# addopts = --showlocals