diff --git a/rhodecode/tests/plugin.py b/rhodecode/tests/plugin.py --- a/rhodecode/tests/plugin.py +++ b/rhodecode/tests/plugin.py @@ -218,7 +218,7 @@ def app(request, pylonsapp, http_environ return app -@pytest.fixture() +@pytest.fixture(scope='session') def app_settings(pylonsapp, pylons_config): """ Settings dictionary used to create the app. @@ -234,6 +234,18 @@ def app_settings(pylonsapp, pylons_confi return settings +@pytest.fixture(scope='session') +def db(app_settings): + """ + Initializes the database connection. + + It uses the same settings which are used to create the ``pylonsapp`` or + ``app`` fixtures. + """ + from rhodecode.config.utils import initialize_database + initialize_database(app_settings) + + LoginData = collections.namedtuple('LoginData', ('csrf_token', 'user'))