diff options
author | David Wobrock <david.wobrock@gmail.com> | 2022-10-02 18:53:05 +0200 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-10-03 06:08:54 +0200 |
commit | 3b4a5b9f97f113ca5151cff744019e39a1ed7475 (patch) | |
tree | 6772017c8d6ba1ed54871172852ab31e5210cab9 /tests/basic | |
parent | da02cbd1effc951b14c981925d0e26a39566649e (diff) | |
download | django-3b4a5b9f97f113ca5151cff744019e39a1ed7475.tar.gz |
Fixed #23353 -- Used "raise from" when raising TransactionManagementError.
This change sets the __cause__ attribute to raised exceptions.
Diffstat (limited to 'tests/basic')
-rw-r--r-- | tests/basic/tests.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/basic/tests.py b/tests/basic/tests.py index 44ace3d684..1d91e39ce9 100644 --- a/tests/basic/tests.py +++ b/tests/basic/tests.py @@ -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 |