Add option to switch backend

This commit is contained in:
vrde 2016-12-06 16:17:26 +01:00 committed by Sylvain Bellemare
parent 6814b06c7b
commit 0a14f97a18
1 changed files with 13 additions and 2 deletions

View File

@ -29,6 +29,15 @@ USER_PRIVATE_KEY = '8eJ8q9ZQpReWyQT5aFCiwtZ5wDZC4eDnCen88p3tQ6ie'
USER_PUBLIC_KEY = 'JEAkEJqLbbgDRAtMm8YAjGp759Aq2qTn9eaEHUj2XePE'
def pytest_addoption(parser):
from bigchaindb.backend import connection
backends = ', '.join(connection.BACKENDS.keys())
parser.addoption('--database-backend', action='store', default='rethinkdb',
help='Defines the backend to use (available: {})'.format(backends))
# We need this function to avoid loading an existing
# conf file located in the home of the user running
# the tests. If it's too aggressive we can change it
@ -49,8 +58,10 @@ def restore_config(request, node_config):
@pytest.fixture(scope='module')
def node_config():
return copy.deepcopy(CONFIG)
def node_config(request):
config = copy.deepcopy(CONFIG)
config['database']['backend'] = request.config.getoption('--database-backend')
return config
@pytest.fixture