Skip to content

Commit

Permalink
Merge pull request ipython#2910 from mgorny/master
Browse files Browse the repository at this point in the history
Respect DB_IP and DB_PORT in mongodb tests

It is usually preferred to run tests on a test-local database with dedicated mongod instance rather than using the system-wide database. In order to support that, an easy way of providing the proper port is handy.

For example, pymongo test suite uses DB_IP and DB_PORT environment variables to allow providing an alternate mongod instance. Using the same variable names in IPython's test suite seems like a good idea.
  • Loading branch information
minrk committed Feb 13, 2013
2 parents 465f43c + b0f830f commit 64c76a1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion IPython/parallel/tests/test_mongodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
# Imports
#-------------------------------------------------------------------------------

import os

from unittest import TestCase

from nose import SkipTest
Expand All @@ -25,8 +27,14 @@

from . import test_db

conn_kwargs = {}
if 'DB_IP' in os.environ:
conn_kwargs['host'] = os.environ['DB_IP']
if 'DB_PORT' in os.environ:
conn_kwargs['port'] = int(os.environ['DB_PORT'])

try:
c = Connection()
c = Connection(**conn_kwargs)
except Exception:
c=None

Expand Down

0 comments on commit 64c76a1

Please sign in to comment.