[1.5.x] Cleaned up some lingering signals in the test suite that were causing spurious failures with Pypy and Postgres.

Backport of db09a2de6e
This commit is contained in:
Julien Phalip 2013-02-08 12:12:03 -08:00
parent b8c6de31a6
commit 15796db507
3 changed files with 17 additions and 0 deletions

View File

@ -207,6 +207,9 @@ class UpdateOnlyFieldsTests(TestCase):
self.assertEqual(len(post_save_data[0]), 1) self.assertEqual(len(post_save_data[0]), 1)
self.assertTrue('name' in post_save_data[0]) self.assertTrue('name' in post_save_data[0])
pre_save.disconnect(pre_save_receiver)
post_save.disconnect(post_save_receiver)
def test_update_fields_incorrect_params(self): def test_update_fields_incorrect_params(self):
s = Person.objects.create(name='Sara', gender='F') s = Person.objects.create(name='Sara', gender='F')
@ -233,6 +236,9 @@ class UpdateOnlyFieldsTests(TestCase):
self.assertEqual(len(pre_save_data), 0) self.assertEqual(len(pre_save_data), 0)
self.assertEqual(len(post_save_data), 0) self.assertEqual(len(post_save_data), 0)
pre_save.disconnect(pre_save_receiver)
post_save.disconnect(post_save_receiver)
def test_num_queries_inheritance(self): def test_num_queries_inheritance(self):
s = Employee.objects.create(name='Sara', gender='F') s = Employee.objects.create(name='Sara', gender='F')
s.employee_num = 1 s.employee_num = 1

View File

@ -92,6 +92,8 @@ class FlagViewTests(CommentTestCase):
self.testFlagPost() self.testFlagPost()
self.assertEqual(received_signals, [signals.comment_was_flagged]) self.assertEqual(received_signals, [signals.comment_was_flagged])
signals.comment_was_flagged.disconnect(receive)
def makeModerator(username): def makeModerator(username):
u = User.objects.get(username=username) u = User.objects.get(username=username)
ct = ContentType.objects.get_for_model(Comment) ct = ContentType.objects.get_for_model(Comment)
@ -163,6 +165,8 @@ class DeleteViewTests(CommentTestCase):
self.testDeletePost() self.testDeletePost()
self.assertEqual(received_signals, [signals.comment_was_flagged]) self.assertEqual(received_signals, [signals.comment_was_flagged])
signals.comment_was_flagged.disconnect(receive)
def testDeletedView(self): def testDeletedView(self):
comments = self.createSomeComments() comments = self.createSomeComments()
pk = comments[0].pk pk = comments[0].pk
@ -238,6 +242,8 @@ class ApproveViewTests(CommentTestCase):
self.testApprovePost() self.testApprovePost()
self.assertEqual(received_signals, [signals.comment_was_flagged]) self.assertEqual(received_signals, [signals.comment_was_flagged])
signals.comment_was_flagged.disconnect(receive)
def testApprovedView(self): def testApprovedView(self):
comments = self.createSomeComments() comments = self.createSomeComments()
pk = comments[0].pk pk = comments[0].pk

View File

@ -1758,6 +1758,11 @@ class SignalTests(TestCase):
self.assertEqual(pre_delete_receiver._database, "other") self.assertEqual(pre_delete_receiver._database, "other")
self.assertEqual(post_delete_receiver._database, "other") self.assertEqual(post_delete_receiver._database, "other")
signals.pre_save.disconnect(sender=Person, receiver=pre_save_receiver)
signals.post_save.disconnect(sender=Person, receiver=post_save_receiver)
signals.pre_delete.disconnect(sender=Person, receiver=pre_delete_receiver)
signals.post_delete.disconnect(sender=Person, receiver=post_delete_receiver)
def test_database_arg_m2m(self): def test_database_arg_m2m(self):
""" """
Test that the m2m_changed signal has a correct database arg (#13552) Test that the m2m_changed signal has a correct database arg (#13552)