Tool: Pyflakes Processed Files: reviewboard/reviews/managers.py Tool: PEP8 Style Checker Processed Files: reviewboard/reviews/managers.py
Wrap local-id computation in transaction.atomic()
Review Request #8710 — Created Feb. 3, 2017 and submitted
We have some custom SQL that has to run to compute the local-site specific ID
for review requests. Previously, we called
this, which works fine in production, but is problematic when running under
Django 1.8's unit test class, which puts the entire test case into an atomic
Instead of manually calling
transaction.commit(), I've wrapped the SQL in its
own atomic block. In production, this acts the same as calling
afterwards, but in the test case (where it's a nested atomic block), it runs as
a "save point", doing the right thing instead of crashing.
Ran unit tests on 1.6 and 1.8.