From db09a2de6e1bc7121d301dad9610efcda9c7a925 Mon Sep 17 00:00:00 2001 From: Julien Phalip Date: Fri, 8 Feb 2013 12:12:03 -0800 Subject: [PATCH] Cleaned up some lingering signals in the test suite that were causing spurious failures with Pypy and Postgres. --- tests/modeltests/update_only_fields/tests.py | 6 ++++++ .../comment_tests/tests/moderation_view_tests.py | 6 ++++++ tests/regressiontests/multiple_database/tests.py | 5 +++++ 3 files changed, 17 insertions(+) diff --git a/tests/modeltests/update_only_fields/tests.py b/tests/modeltests/update_only_fields/tests.py index 9ca0f968d1a..97c05ddc793 100644 --- a/tests/modeltests/update_only_fields/tests.py +++ b/tests/modeltests/update_only_fields/tests.py @@ -207,6 +207,9 @@ class UpdateOnlyFieldsTests(TestCase): self.assertEqual(len(post_save_data[0]), 1) 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): 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(post_save_data), 0) + pre_save.disconnect(pre_save_receiver) + post_save.disconnect(post_save_receiver) + def test_num_queries_inheritance(self): s = Employee.objects.create(name='Sara', gender='F') s.employee_num = 1 diff --git a/tests/regressiontests/comment_tests/tests/moderation_view_tests.py b/tests/regressiontests/comment_tests/tests/moderation_view_tests.py index 0abeff96873..c932fed2d27 100644 --- a/tests/regressiontests/comment_tests/tests/moderation_view_tests.py +++ b/tests/regressiontests/comment_tests/tests/moderation_view_tests.py @@ -93,6 +93,8 @@ class FlagViewTests(CommentTestCase): self.testFlagPost() self.assertEqual(received_signals, [signals.comment_was_flagged]) + signals.comment_was_flagged.disconnect(receive) + def makeModerator(username): u = User.objects.get(username=username) ct = ContentType.objects.get_for_model(Comment) @@ -164,6 +166,8 @@ class DeleteViewTests(CommentTestCase): self.testDeletePost() self.assertEqual(received_signals, [signals.comment_was_flagged]) + signals.comment_was_flagged.disconnect(receive) + def testDeletedView(self): comments = self.createSomeComments() pk = comments[0].pk @@ -239,6 +243,8 @@ class ApproveViewTests(CommentTestCase): self.testApprovePost() self.assertEqual(received_signals, [signals.comment_was_flagged]) + signals.comment_was_flagged.disconnect(receive) + def testApprovedView(self): comments = self.createSomeComments() pk = comments[0].pk diff --git a/tests/regressiontests/multiple_database/tests.py b/tests/regressiontests/multiple_database/tests.py index a79c9c0aa10..2bff7b3b66f 100644 --- a/tests/regressiontests/multiple_database/tests.py +++ b/tests/regressiontests/multiple_database/tests.py @@ -1761,6 +1761,11 @@ class SignalTests(TestCase): self.assertEqual(pre_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): """ Test that the m2m_changed signal has a correct database arg (#13552)