~robru/gwibber/foursquare-fixup

Viewing all changes in revision 1437.

  • Committer: Barry Warsaw
  • Date: 2012-09-21 14:11:34 UTC
  • mfrom: (1436.1.1 flickr)
  • Revision ID: barry@python.org-20120921141134-0t3ibxe35e4yqetd
Rework several aspects of the testing infrastructure to give us several
improvements:

* We no longer pollute the user's gwibber.log file with test output.
* We can assert log output even in sub-thread operations.
* We can synchronize the main thread (i.e. the test runner) with the
  sub-thread operations, to avoid race conditions in outcome assertions.

Details:

* AuthorizationError gets a nice str()
* Temporarily (until the rest of the flickr.py protocol is ported to Dee), add
  an alias for 'images' called 'received'.
* Don't try to translate log messages.
* Eliminate the LogPreserver helper; it's much better to mock the protocol
  module's 'log' attribute.  This is done through the use of the new LogMock
  class.
* Move SettingsIterMock to gwibber.testing.mocks.
* The new LogMock class uses a QueueHandler to capture all log messages, even
  those that happen in a protocol operation sub-thread.
* Adapt existing tests to use LogMock.
* Add a synchronization flag which can be mocked to True to enable main
  thread/operations thread synchronization through a Barrier.  Also, add a
  Thread subclass which catches any exceptions in the sub-thread, logs, and
  swallows it.  To enable synchronization, set Base._SYNCHRONIZE to True.

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: