Files
Timmy-time-dashboard/pytest.ini
Alexander Whitestone e5190b248a CI/CD Optimization: Guard Rails, Pre-commit Checks, and Test Fixes (#90)
* CI/CD Optimization: Guard Rails, Black Linting, and Pre-commit Hooks

- Fixed all test collection errors (Selenium imports, fixture paths, syntax)
- Implemented pre-commit hooks with Black formatting and isort
- Created comprehensive Makefile with test targets (unit, integration, functional, e2e)
- Added pytest.ini with marker definitions for test categorization
- Established guard rails to prevent future collection errors
- Wrapped optional dependencies (Selenium, MoviePy) in try-except blocks
- Added conftest_markers for automatic test categorization

This ensures a smooth development stream with:
- Fast feedback loops (pre-commit checks before push)
- Consistent code formatting (Black)
- Reliable CI/CD (no collection errors, proper test isolation)
- Clear test organization (unit, integration, functional, E2E)

* Fix CI/CD test failures:
- Export templates from dashboard.app
- Fix model name assertion in test_agent.py
- Fix platform-agnostic path resolution in test_path_resolution.py
- Skip Docker tests in test_docker_deployment.py if docker not available
- Fix test_model_fallback_chain logic in test_ollama_integration.py

* Add preventative pre-commit checks and Docker test skipif decorators:
- Create pre_commit_checks.py script for common CI failures
- Add skipif decorators to Docker tests
- Improve test robustness for CI environments
2026-02-28 11:36:50 -05:00

55 lines
1.3 KiB
INI

[pytest]
# Test discovery and execution configuration
testpaths = tests
pythonpath = src:tests
asyncio_mode = auto
asyncio_default_fixture_loop_scope = function
timeout = 30
timeout_method = signal
timeout_func_only = false
# Test markers for categorization and selective execution
markers =
unit: Unit tests (fast, no I/O, no external services)
integration: Integration tests (may use SQLite, in-process agents)
functional: Functional tests (real HTTP requests, no mocking)
e2e: End-to-end tests (full system, may be slow)
slow: Tests that take >1 second
selenium: Requires Selenium and Chrome (browser automation)
docker: Requires Docker and docker-compose
ollama: Requires Ollama service running
external_api: Requires external API access
skip_ci: Skip in CI environment (local development only)
# Output and reporting
addopts =
-v
--tb=short
--strict-markers
--disable-warnings
# Coverage configuration
[coverage:run]
source = src
omit =
*/tests/*
*/site-packages/*
[coverage:report]
show_missing = true
skip_empty = true
precision = 1
exclude_lines =
pragma: no cover
if __name__ == .__main__.
if TYPE_CHECKING:
raise NotImplementedError
@abstractmethod
fail_under = 60
[coverage:html]
directory = htmlcov
[coverage:xml]
output = coverage.xml