mirror of
https://github.com/django/django.git
synced 2025-11-25 21:22:14 +00:00
Fixed #23353 -- Used "raise from" when raising TransactionManagementError.
This change sets the __cause__ attribute to raised exceptions.
This commit is contained in:
parent
da02cbd1ef
commit
3b4a5b9f97
4 changed files with 10 additions and 4 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue