pytest: added db_connection fixture.
This commit is contained in:
parent
3646370376
commit
a5b2b0d0a8
2 changed files with 16 additions and 1 deletions
|
|
@ -30,6 +30,7 @@ import subprocess32
|
|||
import time
|
||||
import uuid
|
||||
import dateutil.tz
|
||||
import functools
|
||||
|
||||
import mock
|
||||
import pyramid.testing
|
||||
|
|
@ -65,7 +66,7 @@ from rhodecode.tests import (
|
|||
TEST_USER_REGULAR_PASS)
|
||||
from rhodecode.tests.utils import CustomTestApp, set_anonymous_access
|
||||
from rhodecode.tests.fixture import Fixture
|
||||
|
||||
from rhodecode.config import utils as config_utils
|
||||
|
||||
def _split_comma(value):
|
||||
return value.split(',')
|
||||
|
|
@ -254,6 +255,12 @@ def app_settings(baseapp, ini_config):
|
|||
return baseapp.config.get_settings()
|
||||
|
||||
|
||||
@pytest.fixture(scope='session')
|
||||
def db_connection(ini_settings):
|
||||
# Initialize the database connection.
|
||||
config_utils.initialize_database(ini_settings)
|
||||
|
||||
|
||||
LoginData = collections.namedtuple('LoginData', ('csrf_token', 'user'))
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@ import configobj
|
|||
import pytest
|
||||
|
||||
import pyramid.paster
|
||||
|
||||
from rhodecode.lib.pyramid_utils import get_app_config
|
||||
from rhodecode.tests.fixture import TestINI
|
||||
import rhodecode
|
||||
|
||||
|
|
@ -277,6 +279,12 @@ def ini_config(request, tmpdir_factory, rcserver_port, vcsserver_port):
|
|||
return filename
|
||||
|
||||
|
||||
@pytest.fixture(scope='session')
|
||||
def ini_settings(ini_config):
|
||||
ini_path = ini_config
|
||||
return get_app_config(ini_path)
|
||||
|
||||
|
||||
@pytest.fixture(scope='session')
|
||||
def rcserver_port(request):
|
||||
port = get_available_port()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue