Changeset - 163d1c4f2b8b
[Not reviewed]
default
1 4 0
Mads Kiilerich - 8 years ago 2017-09-14 02:08:07
mads@kiilerich.com
tests: generate test.ini directly from template

Get rid of the committed generated test.ini
5 files changed with 24 insertions and 475 deletions:
0 comments (0 inline, 0 general)
MANIFEST.in
Show inline comments
 
@@ -24,6 +24,5 @@ recursive-include kallithea/tests/fixtur
 
recursive-include kallithea/tests/scripts *
 
include           kallithea/tests/models/test_dump_html_mails.ref.html
 
include           kallithea/tests/performance/test_vcs.py
 
include           kallithea/tests/test.ini
 
include           kallithea/tests/vcs/aconfig
 
recursive-include scripts *
kallithea/tests/conftest.py
Show inline comments
 
@@ -12,6 +12,7 @@ import pytest
 
from pytest_localserver.http import WSGIServer
 

	
 
from kallithea.controllers.root import RootController
 
from kallithea.lib import inifile
 
from kallithea.lib.utils import repo2db_mapper
 
from kallithea.model.user import UserModel
 
from kallithea.model.meta import Session
 
@@ -36,18 +37,32 @@ def pytest_configure():
 
    # Disable INFO logging of test database creation, restore with NOTSET
 
    logging.disable(logging.INFO)
 

	
 
    with open(os.path.join(path, 'kallithea/tests/test.ini'), 'r') as input_file:
 
        test_ini = input_file.read()
 

	
 
    ini_settings = {
 
        '[server:main]': {
 
            'port': '4999',
 
        },
 
        '[app:main]': {
 
            'app_instance_uuid': 'test',
 
            'show_revision_number': 'true',
 
            'beaker.cache.sql_cache_short.expire': '1',
 
            'beaker.session.secret': '{74e0cd75-b339-478b-b129-07dd221def1f}',
 
        },
 
        '[handler_console]': {
 
            'formatter': 'color_formatter',
 
        },
 
        # The 'handler_console_sql' block is very similar to the one in
 
        # development.ini, but without the explicit 'level=DEBUG' setting:
 
        # it causes duplicate sqlalchemy debug logs, one through
 
        # handler_console_sql and another through another path.
 
        '[handler_console_sql]': {
 
            'formatter': 'color_formatter_sql',
 
        },
 
    }
 
    if os.environ.get('TEST_DB'):
 
        test_ini = re.sub('^\s*sqlalchemy.url\s*=.*$',
 
                           'sqlalchemy.url = %s' % os.environ.get('TEST_DB'),
 
                           test_ini,
 
                           flags=re.M)
 
        ini_settings['[app:main]']['sqlalchemy.url'] = os.environ.get('TEST_DB')
 

	
 
    test_ini_file = os.path.join(TESTS_TMP_PATH, 'test.ini')
 
    with open(test_ini_file, 'w') as output_file:
 
        output_file.write(test_ini)
 
    inifile.create(test_ini_file, None, ini_settings)
 

	
 
    context = loadwsgi.loadcontext(loadwsgi.APP, 'config:%s' % test_ini_file)
 
    from kallithea.tests.fixture import create_test_env, create_test_index
kallithea/tests/test.ini
Show inline comments
 
deleted file
scripts/generate-ini.py
Show inline comments
 
@@ -11,29 +11,6 @@ from kallithea.lib import inifile
 

	
 
# files to be generated from the mako template
 
ini_files = [
 
    ('kallithea/tests/test.ini',
 
        {
 
            '[server:main]': {
 
                'port': '4999',
 
            },
 
            '[app:main]': {
 
                'app_instance_uuid': 'test',
 
                'show_revision_number': 'true',
 
                'beaker.cache.sql_cache_short.expire': '1',
 
                'beaker.session.secret': '{74e0cd75-b339-478b-b129-07dd221def1f}',
 
            },
 
            '[handler_console]': {
 
                'formatter': 'color_formatter',
 
            },
 
            # The 'handler_console_sql' block is very similar to the one in
 
            # development.ini, but without the explicit 'level=DEBUG' setting:
 
            # it causes duplicate sqlalchemy debug logs, one through
 
            # handler_console_sql and another through another path.
 
            '[handler_console_sql]': {
 
                'formatter': 'color_formatter_sql',
 
            },
 
        },
 
    ),
 
    ('development.ini',
 
        {
 
            '[server:main]': {
scripts/manifest
Show inline comments
 
@@ -918,7 +918,6 @@ kallithea/tests/scripts/create_rc.sh
 
kallithea/tests/scripts/manual_test_concurrency.py
 
kallithea/tests/scripts/manual_test_crawler.py
 
kallithea/tests/scripts/mem_watch
 
kallithea/tests/test.ini
 
kallithea/tests/vcs/
 
kallithea/tests/vcs/__init__.py
 
kallithea/tests/vcs/aconfig
0 comments (0 inline, 0 general)