There's at least one problem with your example: the method you're decorating with transaction.non_atomic_requests
isn't a Django view (i.e. a callable that accepts a request and returns a response).
I've converted into a working test case, and that test passes under MySQL.
from django.contrib.auth.models import User
from django.db import transaction
from django.test import TransactionTestCase
class Ticket22947Test(TransactionTestCase):
available_apps = ['django.contrib.auth', 'blabla']
def test_ticket_22947(self):
self.assertEqual(0, User.objects.count())
array = [[[['John', 20], ['Bob', 30], ['Mark', 'not number']]]]
transaction.set_autocommit(False)
for item in array:
try:
user = User()
user.name = item[0]
user.age = item[1]
user.save()
except:
transaction.rollback()
transaction.commit()
transaction.set_autocommit(True)
self.assertEqual(0, User.objects.count())
Please see TicketClosingReasons/UseSupportChannels for further help on this issue.