##// END OF EJS Templates
tests: generate test.ini directly from template...
Mads Kiilerich -
r6820:163d1c4f default
parent child Browse files
Show More
@@ -24,6 +24,5 b' recursive-include kallithea/tests/fixtur'
24 recursive-include kallithea/tests/scripts *
24 recursive-include kallithea/tests/scripts *
25 include kallithea/tests/models/test_dump_html_mails.ref.html
25 include kallithea/tests/models/test_dump_html_mails.ref.html
26 include kallithea/tests/performance/test_vcs.py
26 include kallithea/tests/performance/test_vcs.py
27 include kallithea/tests/test.ini
28 include kallithea/tests/vcs/aconfig
27 include kallithea/tests/vcs/aconfig
29 recursive-include scripts *
28 recursive-include scripts *
@@ -12,6 +12,7 b' import pytest'
12 from pytest_localserver.http import WSGIServer
12 from pytest_localserver.http import WSGIServer
13
13
14 from kallithea.controllers.root import RootController
14 from kallithea.controllers.root import RootController
15 from kallithea.lib import inifile
15 from kallithea.lib.utils import repo2db_mapper
16 from kallithea.lib.utils import repo2db_mapper
16 from kallithea.model.user import UserModel
17 from kallithea.model.user import UserModel
17 from kallithea.model.meta import Session
18 from kallithea.model.meta import Session
@@ -36,18 +37,32 b' def pytest_configure():'
36 # Disable INFO logging of test database creation, restore with NOTSET
37 # Disable INFO logging of test database creation, restore with NOTSET
37 logging.disable(logging.INFO)
38 logging.disable(logging.INFO)
38
39
39 with open(os.path.join(path, 'kallithea/tests/test.ini'), 'r') as input_file:
40 ini_settings = {
40 test_ini = input_file.read()
41 '[server:main]': {
41
42 'port': '4999',
43 },
44 '[app:main]': {
45 'app_instance_uuid': 'test',
46 'show_revision_number': 'true',
47 'beaker.cache.sql_cache_short.expire': '1',
48 'beaker.session.secret': '{74e0cd75-b339-478b-b129-07dd221def1f}',
49 },
50 '[handler_console]': {
51 'formatter': 'color_formatter',
52 },
53 # The 'handler_console_sql' block is very similar to the one in
54 # development.ini, but without the explicit 'level=DEBUG' setting:
55 # it causes duplicate sqlalchemy debug logs, one through
56 # handler_console_sql and another through another path.
57 '[handler_console_sql]': {
58 'formatter': 'color_formatter_sql',
59 },
60 }
42 if os.environ.get('TEST_DB'):
61 if os.environ.get('TEST_DB'):
43 test_ini = re.sub('^\s*sqlalchemy.url\s*=.*$',
62 ini_settings['[app:main]']['sqlalchemy.url'] = os.environ.get('TEST_DB')
44 'sqlalchemy.url = %s' % os.environ.get('TEST_DB'),
45 test_ini,
46 flags=re.M)
47
63
48 test_ini_file = os.path.join(TESTS_TMP_PATH, 'test.ini')
64 test_ini_file = os.path.join(TESTS_TMP_PATH, 'test.ini')
49 with open(test_ini_file, 'w') as output_file:
65 inifile.create(test_ini_file, None, ini_settings)
50 output_file.write(test_ini)
51
66
52 context = loadwsgi.loadcontext(loadwsgi.APP, 'config:%s' % test_ini_file)
67 context = loadwsgi.loadcontext(loadwsgi.APP, 'config:%s' % test_ini_file)
53 from kallithea.tests.fixture import create_test_env, create_test_index
68 from kallithea.tests.fixture import create_test_env, create_test_index
@@ -11,29 +11,6 b' from kallithea.lib import inifile'
11
11
12 # files to be generated from the mako template
12 # files to be generated from the mako template
13 ini_files = [
13 ini_files = [
14 ('kallithea/tests/test.ini',
15 {
16 '[server:main]': {
17 'port': '4999',
18 },
19 '[app:main]': {
20 'app_instance_uuid': 'test',
21 'show_revision_number': 'true',
22 'beaker.cache.sql_cache_short.expire': '1',
23 'beaker.session.secret': '{74e0cd75-b339-478b-b129-07dd221def1f}',
24 },
25 '[handler_console]': {
26 'formatter': 'color_formatter',
27 },
28 # The 'handler_console_sql' block is very similar to the one in
29 # development.ini, but without the explicit 'level=DEBUG' setting:
30 # it causes duplicate sqlalchemy debug logs, one through
31 # handler_console_sql and another through another path.
32 '[handler_console_sql]': {
33 'formatter': 'color_formatter_sql',
34 },
35 },
36 ),
37 ('development.ini',
14 ('development.ini',
38 {
15 {
39 '[server:main]': {
16 '[server:main]': {
@@ -918,7 +918,6 b' kallithea/tests/scripts/create_rc.sh'
918 kallithea/tests/scripts/manual_test_concurrency.py
918 kallithea/tests/scripts/manual_test_concurrency.py
919 kallithea/tests/scripts/manual_test_crawler.py
919 kallithea/tests/scripts/manual_test_crawler.py
920 kallithea/tests/scripts/mem_watch
920 kallithea/tests/scripts/mem_watch
921 kallithea/tests/test.ini
922 kallithea/tests/vcs/
921 kallithea/tests/vcs/
923 kallithea/tests/vcs/__init__.py
922 kallithea/tests/vcs/__init__.py
924 kallithea/tests/vcs/aconfig
923 kallithea/tests/vcs/aconfig
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now