From 229360d7adaabb685fd02b92f4f74ff568b6a50d Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Fri, 16 Sep 2022 11:14:27 +0200 Subject: [PATCH] Fixed test_relational_post_delete_signals_happen_before_parent_object when run in isolation. --- tests/delete/tests.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/delete/tests.py b/tests/delete/tests.py index 977294427c..d03492bb6f 100644 --- a/tests/delete/tests.py +++ b/tests/delete/tests.py @@ -422,9 +422,9 @@ class DeletionTests(TestCase): self.assertIs(type(instance), S) deletions.append(instance.id) - r = R.objects.create(pk=1) - S.objects.create(pk=1, r=r) - + r = R.objects.create() + s = S.objects.create(r=r) + s_id = s.pk models.signals.post_delete.connect(log_post_delete, sender=S) try: @@ -433,7 +433,7 @@ class DeletionTests(TestCase): models.signals.post_delete.disconnect(log_post_delete) self.assertEqual(len(deletions), 1) - self.assertEqual(deletions[0], 1) + self.assertEqual(deletions[0], s_id) @skipUnlessDBFeature("can_defer_constraint_checks") def test_can_defer_constraint_checks(self):