mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #23353 -- Used "raise from" when raising TransactionManagementError.
This change sets the __cause__ attribute to raised exceptions.
This commit is contained in:
committed by
Mariusz Felisiak
parent
da02cbd1ef
commit
3b4a5b9f97
@@ -805,8 +805,9 @@ class SelectOnSaveTests(TestCase):
|
||||
"An error occurred in the current transaction. You can't "
|
||||
"execute queries until the end of the 'atomic' block."
|
||||
)
|
||||
with self.assertRaisesMessage(DatabaseError, msg):
|
||||
with self.assertRaisesMessage(DatabaseError, msg) as cm:
|
||||
asos.save(update_fields=["pub_date"])
|
||||
self.assertIsInstance(cm.exception.__cause__, DatabaseError)
|
||||
finally:
|
||||
Article._base_manager._queryset_class = orig_class
|
||||
|
||||
|
||||
Reference in New Issue
Block a user