mirror of
https://github.com/django/django.git
synced 2024-11-21 19:09:18 +01:00
Fixed random delete.tests.DeletionTests.test_deletion_order failures.
This commit is contained in:
parent
ecbb5db65d
commit
6e9e7ec472
@ -397,18 +397,35 @@ class DeletionTests(TestCase):
|
||||
models.signals.post_delete.connect(log_post_delete)
|
||||
models.signals.pre_delete.connect(log_pre_delete)
|
||||
|
||||
r = R.objects.create(pk=1)
|
||||
s1 = S.objects.create(pk=1, r=r)
|
||||
s2 = S.objects.create(pk=2, r=r)
|
||||
T.objects.create(pk=1, s=s1)
|
||||
T.objects.create(pk=2, s=s2)
|
||||
RChild.objects.create(r_ptr=r)
|
||||
r = R.objects.create()
|
||||
s1 = S.objects.create(r=r)
|
||||
s2 = S.objects.create(r=r)
|
||||
t1 = T.objects.create(s=s1)
|
||||
t2 = T.objects.create(s=s2)
|
||||
rchild = RChild.objects.create(r_ptr=r)
|
||||
r_pk = r.pk
|
||||
r.delete()
|
||||
self.assertEqual(
|
||||
pre_delete_order, [(T, 2), (T, 1), (RChild, 1), (S, 2), (S, 1), (R, 1)]
|
||||
pre_delete_order,
|
||||
[
|
||||
(T, t2.pk),
|
||||
(T, t1.pk),
|
||||
(RChild, rchild.pk),
|
||||
(S, s2.pk),
|
||||
(S, s1.pk),
|
||||
(R, r_pk),
|
||||
],
|
||||
)
|
||||
self.assertEqual(
|
||||
post_delete_order, [(T, 1), (T, 2), (RChild, 1), (S, 1), (S, 2), (R, 1)]
|
||||
post_delete_order,
|
||||
[
|
||||
(T, t1.pk),
|
||||
(T, t2.pk),
|
||||
(RChild, rchild.pk),
|
||||
(S, s1.pk),
|
||||
(S, s2.pk),
|
||||
(R, r_pk),
|
||||
],
|
||||
)
|
||||
|
||||
models.signals.post_delete.disconnect(log_post_delete)
|
||||
|
Loading…
Reference in New Issue
Block a user