def test_nested_setups(activation_strategy):
    with capturing_stderr_context() as captured:
        logger = logbook.Logger('App')
        test_handler = logbook.TestHandler(level='WARNING')
        mail_handler = make_fake_mail_handler(bubble=True)

        handlers = logbook.NestedSetup([
            logbook.NullHandler(),
            test_handler,
            mail_handler
        ])

        with activation_strategy(handlers):
            logger.warn('This is a warning')
            logger.error('This is also a mail')
            try:
                0 / 1
            except Exception:
                logger.exception()
        logger.warn('And here we go straight back to stderr')

        assert test_handler.has_warning('This is a warning')
        assert test_handler.has_error('This is also a mail')
        assert len(mail_handler.mails) == 2
        assert 'This is also a mail' in mail_handler.mails[0][2]
        assert '1 / 0' in mail_handler.mails[1][2]
        assert 'And here we go straight back to stderr' in captured.getvalue()

        with activation_strategy(handlers):
            logger.warn('threadbound warning')

        handlers.push_application()
        try:
            logger.warn('applicationbound warning')
        finally:
            handlers.pop_application()
dataset/ETHPy150Open getlogbook/logbook/tests/test_handlers.py/test_nested_setups/swapped operands of `/`