Fixed test_relational_post_delete_signals_happen_before_parent_object when run in isolation.

This commit is contained in:
Mariusz Felisiak 2022-09-16 11:14:27 +02:00 committed by GitHub
parent 10178197d5
commit 229360d7ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -422,9 +422,9 @@ class DeletionTests(TestCase):
self.assertIs(type(instance), S) self.assertIs(type(instance), S)
deletions.append(instance.id) deletions.append(instance.id)
r = R.objects.create(pk=1) r = R.objects.create()
S.objects.create(pk=1, r=r) s = S.objects.create(r=r)
s_id = s.pk
models.signals.post_delete.connect(log_post_delete, sender=S) models.signals.post_delete.connect(log_post_delete, sender=S)
try: try:
@ -433,7 +433,7 @@ class DeletionTests(TestCase):
models.signals.post_delete.disconnect(log_post_delete) models.signals.post_delete.disconnect(log_post_delete)
self.assertEqual(len(deletions), 1) self.assertEqual(len(deletions), 1)
self.assertEqual(deletions[0], 1) self.assertEqual(deletions[0], s_id)
@skipUnlessDBFeature("can_defer_constraint_checks") @skipUnlessDBFeature("can_defer_constraint_checks")
def test_can_defer_constraint_checks(self): def test_can_defer_constraint_checks(self):