Changeset - ff287676b206
[Not reviewed]
default
0 3 0
Anton Schur - 9 years ago 2017-04-26 10:21:56
tonich.sh@gmail.com
tests: initial_repo_scan = false in test.ini, explicitly do repo scan in the pytest configure phase.
3 files changed with 12 insertions and 13 deletions:
0 comments (0 inline, 0 general)
kallithea/tests/conftest.py
Show inline comments
 
@@ -8,10 +8,12 @@ from routes.util import URLGenerator
 

	
 
import pytest
 
from kallithea.controllers.root import RootController
 
from kallithea.lib.utils import repo2db_mapper
 
from kallithea.model.user import UserModel
 
from kallithea.model.meta import Session
 
from kallithea.model.db import Setting, User, UserIpMap
 
from kallithea.tests.base import invalidate_all_caches, TEST_USER_REGULAR_LOGIN
 
from kallithea.model.scm import ScmModel
 
from kallithea.tests.base import invalidate_all_caches, TEST_USER_REGULAR_LOGIN, TESTS_TMP_PATH
 
import kallithea.tests.base # FIXME: needed for setting testapp instance!!!
 

	
 
from tg.util.webtest import test_context
 
@@ -26,23 +28,24 @@ def pytest_configure():
 

	
 
    context = loadwsgi.loadcontext(loadwsgi.APP, 'config:kallithea/tests/test.ini', relative_to=path)
 

	
 
    test_env = not int(os.environ.get('KALLITHEA_NO_TMP_PATH', 0))
 
    test_index = not int(os.environ.get('KALLITHEA_WHOOSH_TEST_DISABLE', 0))
 
    if os.environ.get('TEST_DB'):
 
        # swap config if we pass environment variable
 
        context.local_conf['sqlalchemy.url'] = os.environ.get('TEST_DB')
 

	
 
    from kallithea.tests.fixture import create_test_env, create_test_index
 
    from kallithea.tests.base import TESTS_TMP_PATH
 
    # set KALLITHEA_NO_TMP_PATH=1 to disable re-creating the database and
 
    # test repos
 
    if test_env:
 

	
 
    # set KALLITHEA_NO_TMP_PATH=1 to disable re-creating the database and test repos
 
    if not int(os.environ.get('KALLITHEA_NO_TMP_PATH', 0)):
 
        create_test_env(TESTS_TMP_PATH, context.config())
 

	
 
    # set KALLITHEA_WHOOSH_TEST_DISABLE=1 to disable whoosh index during tests
 
    if test_index:
 
    if not int(os.environ.get('KALLITHEA_WHOOSH_TEST_DISABLE', 0)):
 
        create_test_index(TESTS_TMP_PATH, context.config(), True)
 

	
 
    kallithea.tests.base.testapp = context.create()
 
    # do initial repo scan
 
    repo2db_mapper(ScmModel().repo_scan(TESTS_TMP_PATH))
 

	
 
    logging.disable(logging.NOTSET)
 

	
 
    kallithea.tests.base.url = URLGenerator(RootController().mapper, kallithea.tests.base.environ)
kallithea/tests/test.ini
Show inline comments
 
################################################################################
 
################################################################################
 
# Kallithea - config for tests:                                                #
 
# initial_repo_scan = true                                                     #
 
# sqlalchemy and kallithea_test.sqlite                                         #
 
# custom logging                                                               #
 
#                                                                              #
 
@@ -188,8 +187,7 @@ index_dir = %(here)s/../../data/test/ind
 

	
 
## perform a full repository scan on each server start, this should be
 
## set to false after first startup, to allow faster server restarts.
 
#initial_repo_scan = false
 
initial_repo_scan = true
 
initial_repo_scan = false
 

	
 
## uncomment and set this path to use archive download cache
 
#archive_cache_dir = %(here)s/tarballcache
scripts/generate-ini.py
Show inline comments
 
@@ -30,7 +30,6 @@ ini_files = [
 
    ('kallithea/tests/test.ini',
 
        '''
 
        Kallithea - config for tests:
 
        initial_repo_scan = true
 
        sqlalchemy and kallithea_test.sqlite
 
        custom logging
 

	
 
@@ -41,7 +40,6 @@ ini_files = [
 
                'port': '4999',
 
            },
 
            '[app:main]': {
 
                'initial_repo_scan': 'true',
 
                'app_instance_uuid': 'test',
 
                'show_revision_number': 'true',
 
                'beaker.cache.sql_cache_short.expire': '1',
0 comments (0 inline, 0 general)