def signal_listener(signal):
    """Context Manager that listen to signals.

    .. note::

        Checks if any signal were fired and returns the passed arguments.

    .. code-block:: python

        from somesignals import signal

        with signal_listener(signal) as listener:
            fire_the_signal()
            results = listener.assert_signal()
            # Assert the results here

    """

    class _Signal(object):
        def __init__(self):
            self.heard = []

        def add(self, *args, **kwargs):
            """Keep the signals."""
            self.heard.append((args, kwargs))

        def assert_signal(self):
            """Check signal."""
            if len(self.heard) == 0:
                raise AssertionError("No signals.")
            return self.heard[0][0], self.heard[0][1]

    signals = _Signal()
    signal.connect(signals.add)

    try:
        yield signals
    finally:
        signal.disconnect(signals.add)