def test_start(bus, listener, log_tracker):
    """Test that bus start sequence calls all listeners."""
    num = 3
    for index in range(num):
        bus.subscribe('start', listener.get_listener('start', index))

    bus.start()
    try:
        # The start method MUST call all 'start' listeners.
        assert set(listener.responses) == set(
            msg % (i, 'start', None) for i in range(num)
        )
        # The start method MUST move the state to STARTED
        # (or EXITING, if errors occur)
        assert bus.state == bus.states.STARTED
        # The start method MUST log its states.
        assert log_tracker.log_entries == ['Bus STARTING', 'Bus STARTED']
    finally:
        # Exit so the atexit handler doesn't complain.
        bus.exit()
Test that bus start sequence calls all listeners.
cherrypy/test/test_bus.py