30f8e08f7e
CI / lint (push) Failing after 16s
CI / typecheck (push) Successful in 24s
CI / coverage (push) Has been skipped
CI / security (push) Successful in 16s
CI / quality (push) Successful in 14s
CI / build (push) Successful in 13s
CI / behave (3.13) (push) Failing after 4m24s
CI / docker (push) Has been skipped
103 lines
5.9 KiB
Gherkin
103 lines
5.9 KiB
Gherkin
Feature: ADR compliance checker script coverage
|
|
Full line and branch coverage for scripts/check-adr-compliance.py
|
|
|
|
# --- ADR-002: Asyncio Concurrency Model ---
|
|
|
|
Scenario: ADR-002 checker returns empty list when application directory does not exist
|
|
Given a temporary source directory with no application subdirectory
|
|
When the ADR-002 async model checker runs against that source directory
|
|
Then the ADR-002 checker should return an empty violations list
|
|
|
|
Scenario: ADR-002 checker returns empty list when no threading imports found
|
|
Given a temporary source directory with a clean application module
|
|
When the ADR-002 async model checker runs against that source directory
|
|
Then the ADR-002 checker should return an empty violations list
|
|
|
|
Scenario: ADR-002 checker detects import threading violation
|
|
Given a temporary source directory with an application module importing threading directly
|
|
When the ADR-002 async model checker runs against that source directory
|
|
Then the ADR-002 checker should return a violation mentioning "imports threading directly"
|
|
|
|
Scenario: ADR-002 checker detects from threading import violation
|
|
Given a temporary source directory with an application module using from-threading-import
|
|
When the ADR-002 async model checker runs against that source directory
|
|
Then the ADR-002 checker should return a violation mentioning "imports threading directly"
|
|
|
|
# --- ADR-003: Dependency Injection Framework ---
|
|
|
|
Scenario: ADR-003 checker returns empty list when services directory does not exist
|
|
Given a temporary source directory with no services subdirectory
|
|
When the ADR-003 dependency injection checker runs against that source directory
|
|
Then the ADR-003 checker should return an empty violations list
|
|
|
|
Scenario: ADR-003 checker skips dunder init files
|
|
Given a temporary source directory with only an __init__.py in services
|
|
When the ADR-003 dependency injection checker runs against that source directory
|
|
Then the ADR-003 checker should return an empty violations list
|
|
|
|
Scenario: ADR-003 checker skips files with syntax errors
|
|
Given a temporary source directory with a syntactically invalid Python file in services
|
|
When the ADR-003 dependency injection checker runs against that source directory
|
|
Then the ADR-003 checker should return an empty violations list
|
|
|
|
Scenario: ADR-003 checker reports class with empty init having no injected dependencies
|
|
Given a temporary source directory with a service class whose init takes only self
|
|
When the ADR-003 dependency injection checker runs against that source directory
|
|
Then the ADR-003 checker should return a violation mentioning "no injected dependencies"
|
|
|
|
Scenario: ADR-003 checker passes class with proper dependency injection
|
|
Given a temporary source directory with a service class whose init takes self and a dependency
|
|
When the ADR-003 dependency injection checker runs against that source directory
|
|
Then the ADR-003 checker should return an empty violations list
|
|
|
|
Scenario: ADR-003 checker ignores classes without init method
|
|
Given a temporary source directory with a service class that has no init method
|
|
When the ADR-003 dependency injection checker runs against that source directory
|
|
Then the ADR-003 checker should return an empty violations list
|
|
|
|
# --- ADR-007: Repository Pattern for Persistence ---
|
|
|
|
Scenario: ADR-007 checker returns empty list when services directory does not exist
|
|
Given a temporary source directory with no services subdirectory for ADR-007
|
|
When the ADR-007 repository pattern checker runs against that source directory
|
|
Then the ADR-007 checker should return an empty violations list
|
|
|
|
Scenario: ADR-007 checker detects direct SQLAlchemy imports in services
|
|
Given a temporary source directory with a service file importing from sqlalchemy
|
|
When the ADR-007 repository pattern checker runs against that source directory
|
|
Then the ADR-007 checker should return a violation mentioning "SQLAlchemy directly"
|
|
|
|
Scenario: ADR-007 checker detects direct session query usage in services
|
|
Given a temporary source directory with a service file using session.query
|
|
When the ADR-007 repository pattern checker runs against that source directory
|
|
Then the ADR-007 checker should return a violation mentioning "session directly"
|
|
|
|
Scenario: ADR-007 checker detects direct session execute usage in services
|
|
Given a temporary source directory with a service file using session.execute
|
|
When the ADR-007 repository pattern checker runs against that source directory
|
|
Then the ADR-007 checker should return a violation mentioning "session directly"
|
|
|
|
Scenario: ADR-007 checker passes clean services with no SQLAlchemy usage
|
|
Given a temporary source directory with a clean service file using no SQLAlchemy
|
|
When the ADR-007 repository pattern checker runs against that source directory
|
|
Then the ADR-007 checker should return an empty violations list
|
|
|
|
# --- main() function ---
|
|
|
|
Scenario: ADR compliance main returns error when source directory does not exist
|
|
When the ADR compliance main function runs with a nonexistent source directory
|
|
Then the ADR compliance main should return exit code 1
|
|
And the ADR compliance main output should contain "not found"
|
|
|
|
Scenario: ADR compliance main returns success when all checks pass
|
|
Given a temporary project tree with clean source code for ADR compliance
|
|
When the ADR compliance main function runs against that project tree
|
|
Then the ADR compliance main should return exit code 0
|
|
And the ADR compliance main output should contain "All ADR compliance checks passed"
|
|
|
|
Scenario: ADR compliance main returns failure when violations are found
|
|
Given a temporary project tree with ADR violations in the source code
|
|
When the ADR compliance main function runs against that project tree
|
|
Then the ADR compliance main should return exit code 1
|
|
And the ADR compliance main output should contain "ADR compliance issue"
|