In your tests, you don't subclass ServiceRegistry, which effectively means you are treating this as a singleton. This means if someone does subclass this, your instance variables (@) will result in two different set of values for @handler_factory_registry.

This is also not thread-safe but I don't think that's a requirement overall.