diff --git a/tests/conftest.py b/tests/conftest.py index afce0872..013a6e9b 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -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