markitect-main/domain/issues/exceptions.py

44 lines
1.3 KiB
Python
Raw Normal View History

"""
Domain-specific exceptions for issue management.
"""
class IssueDomainError(Exception):
"""Base exception for issue domain errors."""
def __init__(self, message: str, issue_number: int = None):
super().__init__(message)
self.issue_number = issue_number
class IssueValidationError(IssueDomainError):
"""Exception raised when issue validation fails."""
def __init__(self, message: str, field: str = None, value=None):
super().__init__(message)
self.field = field
self.value = value
class IssueStateError(IssueDomainError):
"""Exception raised when invalid state transitions are attempted."""
def __init__(self, message: str, current_state: str, attempted_state: str):
super().__init__(message)
self.current_state = current_state
feat: Implement comprehensive Testing Architecture Enhancement Establishes robust testing framework with clean architecture patterns: ## Phase 1: Test Infrastructure Foundation - Global test configuration with pytest.ini and conftest.py - Isolated test workspaces and environment management - Comprehensive fixture library for all test types - Test requirements and dependency management ## Phase 2: Advanced Testing Patterns - Test builders using builder pattern for domain objects - Mock factories for repositories, services, and configs - API response builders for external system simulation - Enhanced unit tests with proper mocking and isolation ## Phase 3: Test Performance and Quality - Performance testing framework with benchmarks - Memory usage monitoring and leak detection - Custom assertions for domain-specific validation - Parametrized testing for comprehensive coverage ## Phase 4: CI/CD Integration - GitHub Actions workflow for automated testing - Multi-stage testing: unit → integration → e2e → performance - Code quality checks with flake8, mypy, black, isort - Security scanning with safety and bandit ## Testing Architecture Benefits ✅ 100+ new test infrastructure components ✅ Standardized test organization (unit/integration/e2e) ✅ Mock-based testing with no external dependencies ✅ Performance regression detection ✅ Comprehensive fixture library ✅ CI/CD pipeline with quality gates The testing framework supports the domain logic separation and provides a solid foundation for maintaining high code quality as the system evolves. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-26 22:36:35 +02:00
self.attempted_state = attempted_state
class IssueNotFoundError(IssueDomainError):
"""Exception raised when an issue cannot be found."""
def __init__(self, message: str, issue_number: int = None):
super().__init__(message, issue_number)
class IssueLabelError(IssueDomainError):
"""Exception raised when there are label-related issues."""
def __init__(self, message: str, label_name: str = None):
super().__init__(message)
self.label_name = label_name