Are you asking why it's module-level instead of class-level? Because nose reads the module and runs any test classes that match its test-finding regex. Initially I had the idea of defining live test classes in one branch of the "if" and defining mock test classes in the "else". That way, certain class defs will never run and so nose won't see them.

Eventually I decided to just move the live/mock logic into the test itself to reduce redundancy, so you're right, these vars can now be moved into the test class.