Add a registry of Review Bot worker tools.
Review Request #11533 — Created March 17, 2021 and submitted — Latest diff uploaded
Review Bot has been heavily dependent on
pkg_resources.iter_entry_points
for tool lookup. This is fine to use
for an initial scan, but we were calling it on every tool execution,
which was slow, and made it hard to write unit tests against anything
not provided by a package.This change introduces a basic tools registry in
reviewbot.tools.base.registry
. This handles tool discovery,
registration, unregistration, iteration, and fetching of tools.Tools are only discovered on startup now, and we fetch directly from the
registry when executing one.Unit tests were added to cover the new registry functions.
Unit tests pass for Python 2.x and 3.x.
Manually tested starting the worker, loading in the tools list into
Review Board, and running tools against new code.