'Test that commit_on_success raises an error if it is nested inside
atomic or if the isolation level is changed when it is nested
inside another commit_on_success.'

def test_commit_on_success_nesting(self):

    if (connection.vendor != 'mysql'):
        raise unittest.SkipTest('Only    works    on    MySQL.')
    commit_on_success(read_committed=True)(do_nothing)()
    with self.assertRaisesRegexp(TransactionManagementError, 'Cannot    change    isolation    level    when    nested.'):
        with commit_on_success():
            commit_on_success(read_committed=True)(do_nothing)()
    with self.assertRaisesRegexp(TransactionManagementError, 'Cannot    be    inside    an    atomic    block.'):
        with atomic():
            commit_on_success(read_committed=True)(do_nothing)()
