title: Django testing commit_on_success
body: <p>I have a function that I've got wrapped in <code>@transaction.commit_on_success</code> and running Django unit tests on it.</p>
  
  <p>The function is too long to paste, but some pseudocode is:</p>
  
  <pre><code>@transaction.commit_on_success
  def func():
    order = Order.create()
    order.save()
    OrderItem.create(order=order)
    test = 10/0 # make sure we run into an error
  </code></pre>
  
  <p>Then in my unit test I check if <code>len(Order.objects.all()) == 0</code></p>
  
  <p><strong>My function is returning a valid Order object, so the transaction is committing.</strong></p>
  
  <p>What am I doing wrong here?</p>
  
  <p>EDIT: I'm on Django 1.5</p>