'Test that start and stop methods of the observer actually register
and unregister to the log system.'

def test_startStopObserver(self):

    oldAddObserver = log.addObserver
    oldRemoveObserver = log.removeObserver
    l = []
    try:
        log.addObserver = l.append
        log.removeObserver = l.remove
        obs = log.PythonLoggingObserver()
        obs.start()
        self.assertEqual(l[0], obs.emit)
        obs.stop()
        self.assertEqual(len(l), 0)
    finally:
        log.addObserver = oldAddObserver
        log.removeObserver = oldRemoveObserver
