mozilla-services/circus — pull request #348 by ionrock (2013-01-04 18:35:08+00:00)
Title: Fix for #283 - Make autostart available in the watcher config

My apologies for including the FancyStdoutStream in diff. I should have probably branched from an earlier changeset.

Also, I've added mock as a test dependency. As mocks can be somewhat controversial to some, let me clarify how and why I'm using it.

In py.test (the test runner I'm more familiar with) it provides a feature called fixtures (pytest.org/latest/fixture.html) for injecting test requirements. One of the builtin fixtures is monkeypatch, which allows you safely patch objects, classes, functions, etc. for within a test function and have it safely revert to its original value. Mock provides a similar feature with its patch functionality (http://www.voidspace.org.uk/python/mock/patch.html#patch).

Also, I moved the starting of a worker to its own method in order to test it isolation without having to start an ioloop. I'm happy to add an integration test that starts everything up as well. It seemed like overkill in this case and setting a precedent on how to test non-I/O related aspects would be helpful to improve our coverage without making the test suite slower.

Thanks for looking over things!