From ebb9bd1a6a3105b86da4caba9fa0216720ce1680 Mon Sep 17 00:00:00 2001 From: Umair Khan Date: Wed, 24 May 2017 11:33:30 +0500 Subject: [PATCH] testing: Avoid class variables to enforce isolation. Class variables are shared between all instances and as a result changes made by one instance are leaked to other instances. --- zerver/tests/test_events.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/zerver/tests/test_events.py b/zerver/tests/test_events.py index b8137fcdd3..6e789473b4 100644 --- a/zerver/tests/test_events.py +++ b/zerver/tests/test_events.py @@ -340,8 +340,10 @@ class GetEventsTest(ZulipTestCase): self.assertEqual(events[0]["message"]["display_recipient"], "Denmark") class EventsRegisterTest(ZulipTestCase): - user_profile = get_user_profile_by_email('hamlet@zulip.com') - maxDiff = None # type: Optional[int] + def setUp(self): + super(EventsRegisterTest, self).setUp() + self.user_profile = self.example_user('hamlet') + self.maxDiff = None # type: Optional[int] def create_bot(self, email): # type: (str) -> UserProfile