##// END OF EJS Templates
pytest: added db_connection fixture.
marcink -
r2372:2173e0ba default
parent child Browse files
Show More
@@ -30,6 +30,7 b' import subprocess32'
30 30 import time
31 31 import uuid
32 32 import dateutil.tz
33 import functools
33 34
34 35 import mock
35 36 import pyramid.testing
@@ -65,7 +66,7 b' from rhodecode.tests import ('
65 66 TEST_USER_REGULAR_PASS)
66 67 from rhodecode.tests.utils import CustomTestApp, set_anonymous_access
67 68 from rhodecode.tests.fixture import Fixture
68
69 from rhodecode.config import utils as config_utils
69 70
70 71 def _split_comma(value):
71 72 return value.split(',')
@@ -254,6 +255,12 b' def app_settings(baseapp, ini_config):'
254 255 return baseapp.config.get_settings()
255 256
256 257
258 @pytest.fixture(scope='session')
259 def db_connection(ini_settings):
260 # Initialize the database connection.
261 config_utils.initialize_database(ini_settings)
262
263
257 264 LoginData = collections.namedtuple('LoginData', ('csrf_token', 'user'))
258 265
259 266
@@ -30,6 +30,8 b' import configobj'
30 30 import pytest
31 31
32 32 import pyramid.paster
33
34 from rhodecode.lib.pyramid_utils import get_app_config
33 35 from rhodecode.tests.fixture import TestINI
34 36 import rhodecode
35 37
@@ -278,6 +280,12 b' def ini_config(request, tmpdir_factory, '
278 280
279 281
280 282 @pytest.fixture(scope='session')
283 def ini_settings(ini_config):
284 ini_path = ini_config
285 return get_app_config(ini_path)
286
287
288 @pytest.fixture(scope='session')
281 289 def rcserver_port(request):
282 290 port = get_available_port()
283 291 print('Using rcserver port {}'.format(port))
General Comments 0
You need to be logged in to leave comments. Login now