From 174c4b1ff80c321194f4a50f4a60ef9c9831d812 Mon Sep 17 00:00:00 2001 From: Gunther Cox Date: Wed, 3 May 2017 22:08:34 -0400 Subject: [PATCH] Only check if MongoDB is running once durring tests This should increase the speed of the unit test process because it changes the check for if MongoDB is running from every time a test case is run, to only once per test case. --- tests/base_case.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/base_case.py b/tests/base_case.py index 4a1947c9e..cca1cf639 100644 --- a/tests/base_case.py +++ b/tests/base_case.py @@ -42,7 +42,8 @@ def tearDown(self): class ChatBotMongoTestCase(ChatBotTestCase): - def setUp(self): + @classmethod + def setUpClass(cls): from pymongo.errors import ServerSelectionTimeoutError from pymongo import MongoClient @@ -56,8 +57,6 @@ def setUp(self): except ServerSelectionTimeoutError: raise SkipTest('Unable to connect to Mongo DB.') - super(ChatBotMongoTestCase, self).setUp() - def get_kwargs(self): kwargs = super(ChatBotMongoTestCase, self).get_kwargs() kwargs['database'] = self.random_string()