Skip to content

test: add coverage for hook plugin system (hooks.py) #1033

@mnadzam

Description

@mnadzam

Description

src/fromager/hooks.py has 28% unit test coverage with no dedicated unit test file (97% combined coverage including e2e tests). Hooks are the primary extension mechanism, using stevedore for plugin discovery.

The three run_*_hooks() functions have no error handling - exceptions from plugins propagate unpredictably to callers. Error handling varies by call site: bootstrapper.py wraps its call in try/except, but build.py does not.

_get_hooks() uses @with_thread_lock() for thread-safe caching of the hook manager.

Scope

Function Lines Callers
log_hooks() 40-56 1
run_post_build_hooks() 67-91 1
run_post_bootstrap_hooks() 94-118 1
run_prebuilt_wheel_hooks() 121-141 1
_get_hooks() (private) 23-37 3 (internal)

Acceptance Criteria

  • _get_hooks() - test stevedore manager creation and caching behavior
  • run_post_build_hooks() - test with mocked hooks, verify correct arguments are passed
  • Exception propagation - verify behavior when a hook raises an exception
  • log_hooks() - test logging output for loaded plugins

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions