46 lines
2.2 KiB
Gherkin
46 lines
2.2 KiB
Gherkin
@resource_handlers @resolver_coverage
|
|
Feature: Handler resolver edge-case coverage
|
|
As a developer maintaining the handler resolution subsystem
|
|
I want to exercise the uncovered error paths in resolve_handler
|
|
So that every branch in resolver.py is tested
|
|
|
|
Background:
|
|
Given the handler cache is cleared
|
|
|
|
# --- Lines 72-73: empty module_path or class_name after split ---
|
|
|
|
Scenario: Reject handler reference with empty module path
|
|
When I try to resolve handler ref ":SomeClass"
|
|
Then a handler resolution error should be raised with message "both module path and class name are required"
|
|
|
|
Scenario: Reject handler reference with empty class name
|
|
When I try to resolve handler ref "some.module:"
|
|
Then a handler resolution error should be raised with message "both module path and class name are required"
|
|
|
|
# --- Lines 84-87: generic Exception (not ModuleNotFoundError) during import ---
|
|
|
|
Scenario: Generic exception during module import raises HandlerResolutionError
|
|
Given a module import that raises a generic RuntimeError
|
|
When I try to resolve the rigged handler reference
|
|
Then a handler resolution error should be raised with message "Error importing handler module"
|
|
|
|
# --- Lines 99-102: Exception during handler class instantiation ---
|
|
|
|
Scenario: Exception during handler instantiation raises HandlerResolutionError
|
|
Given a module whose handler class raises TypeError on init
|
|
When I try to resolve the rigged handler reference
|
|
Then a handler resolution error should be raised with message "Cannot instantiate handler"
|
|
|
|
# --- Lines 106-107: instantiated object does not satisfy ResourceHandler protocol ---
|
|
|
|
Scenario: Handler class not satisfying ResourceHandler protocol is rejected
|
|
Given a module whose handler class does not satisfy ResourceHandler
|
|
When I try to resolve the rigged handler reference
|
|
Then a handler resolution error should be raised with message "does not satisfy ResourceHandler protocol"
|
|
|
|
# --- Whitespace-only reference triggers line 53-54 ---
|
|
|
|
Scenario: Whitespace-only handler reference is treated as empty
|
|
When I try to resolve handler ref " "
|
|
Then a handler resolution error should be raised with message "must not be empty"
|