Alvaro Cavalcanti
Alvaro Cavalcanti

Reputation: 3078

Django ATOMIC_REQUESTS not working

So,

We have this Django Rest Framework application that has some View's methods decorated with @transaction.atomic.

Within this app we also have a test which checks this behaviour by mocking an internal call to throw an error while trying to update a model. Currently, the test passes (the changes do not take place due to the error being thrown).

The problem is, we want to drop the decorations and set all transactions to be atomic. In this case we went for the ATOMIC_REQUESTS database configuration flag. But upon doing that, the test now fails (the model gets updated!).

We managed to print out the config.DATABASES value and the ATOMIC_REQUESTS is there, so it should behave accordingly, right? What are we missing?

Upvotes: 4

Views: 1229

Answers (1)

Alvaro Cavalcanti
Alvaro Cavalcanti

Reputation: 3078

As for now, this is an issue on Django-Rest-Framework, as documented here: https://github.com/tomchristie/django-rest-framework/issues/2034

Upvotes: 3

Related Questions