Skip to content

Commit

Permalink
Only check if MongoDB is running once durring tests
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gunthercox committed May 4, 2017
1 parent 22f43de commit 174c4b1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions tests/base_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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()
Expand Down

0 comments on commit 174c4b1

Please sign in to comment.