ui/rq-scheduler — pull request #32 by paulmelnikow (2013-12-20 20:49:22+00:00)
Title: Lazily import resolve_connection to allow safe patching

Thanks for the great library!

I'm unit testing a subclass of Scheduler and want to test how my overridden method interacts with the superclass. I need an instance of the class which does not interact with Redis, and I think the best way is to patch resolve_connection. (resolve_connection will complain if you pass it an object which is not a Redis object).

Without this change, the patch worked if I ran the test in isolation. But if I ran any tests which imported this file first, the import would already have happened and the patch wouldn't take effect.