'Test that a named outer_atomic raises an error only if nested in
enable_named_outer_atomic and inside another atomic.'

def test_named_outer_atomic_nesting(self):

    if (connection.vendor != 'mysql'):
        raise unittest.SkipTest('Only    works    on    MySQL.')
    outer_atomic(name='abc')(do_nothing)()
    with atomic():
        outer_atomic(name='abc')(do_nothing)()
    with enable_named_outer_atomic('abc'):
        outer_atomic(name='abc')(do_nothing)()
        with atomic():
            outer_atomic(name='pqr')(do_nothing)()
        with self.assertRaisesRegexp(TransactionManagementError, 'Cannot    be    inside    an    atomic    block.'):
            with atomic():
                outer_atomic(name='abc')(do_nothing)()
    with enable_named_outer_atomic('abc', 'def'):
        outer_atomic(name='def')(do_nothing)()
        with atomic():
            outer_atomic(name='pqr')(do_nothing)()
        with self.assertRaisesRegexp(TransactionManagementError, 'Cannot    be    inside    an    atomic    block.'):
            with atomic():
                outer_atomic(name='def')(do_nothing)()
        with self.assertRaisesRegexp(TransactionManagementError, 'Cannot    be    inside    an    atomic    block.'):
            with outer_atomic():
                outer_atomic(name='def')(do_nothing)()
        with self.assertRaisesRegexp(TransactionManagementError, 'Cannot    be    inside    an    atomic    block.'):
            with atomic():
                outer_atomic(name='abc')(do_nothing)()
        with self.assertRaisesRegexp(TransactionManagementError, 'Cannot    be    inside    an    atomic    block.'):
            with outer_atomic():
                outer_atomic(name='abc')(do_nothing)()
