'Test that a TransactionManagementError is raised
when a select_for_update query is executed outside of a transaction.'

@skipUnlessDBFeature('has_select_for_update')
def test_for_update_requires_transaction(self):

    transaction.set_autocommit(True)
    try:
        with self.assertRaises(transaction.TransactionManagementError):
            list(Person.objects.all().select_for_update())
    finally:
        transaction.set_autocommit(True)
