Show More
@@ -112,18 +112,6 b' def load_environment(global_conf, app_co' | |||
|
112 | 112 | |
|
113 | 113 | # sets the c attribute access when don't existing attribute are accessed |
|
114 | 114 | config['pylons.strict_tmpl_context'] = True |
|
115 | config_file_name = os.path.split(config['__file__'])[-1] | |
|
116 | test = re.match('^test[\w_]*\.ini$', config_file_name) is not None | |
|
117 | if test: | |
|
118 | if test_env is None: | |
|
119 | test_env = not int(os.environ.get('RC_NO_TMP_PATH', 0)) | |
|
120 | ||
|
121 | from rhodecode.lib.utils import create_test_env, create_test_index | |
|
122 | from rhodecode.tests import TESTS_TMP_PATH | |
|
123 | # test repos | |
|
124 | if test_env: | |
|
125 | create_test_env(TESTS_TMP_PATH, config) | |
|
126 | create_test_index(TESTS_TMP_PATH, config, True) | |
|
127 | 115 | |
|
128 | 116 | # Limit backends to "vcs.backends" from configuration |
|
129 | 117 | backends = config['vcs.backends'] = aslist( |
@@ -157,14 +157,22 b' def make_pyramid_app(global_config, **se' | |||
|
157 | 157 | # behavior in the old application. |
|
158 | 158 | settings_pylons = settings.copy() |
|
159 | 159 | |
|
160 | # TODO: Remove this by refactoring the init DB function. | |
|
161 | # Put debug flag into settings for DB setup. | |
|
162 | settings['debug'] = global_config.get('debug', False) | |
|
163 | utils.initialize_database(settings) | |
|
160 | # Some parts of the code expect a merge of global and app settings. | |
|
161 | settings_merged = global_config.copy() | |
|
162 | settings_merged.update(settings) | |
|
164 | 163 | |
|
165 | 164 | sanitize_settings_and_apply_defaults(settings) |
|
166 | 165 | config = Configurator(settings=settings) |
|
167 | 166 | add_pylons_compat_data(config.registry, global_config, settings_pylons) |
|
167 | ||
|
168 | # Initialize the database connection. | |
|
169 | utils.initialize_database(settings_merged) | |
|
170 | ||
|
171 | # If this is a test run we prepare the test environment like | |
|
172 | # creating a test database, test search index and test repositories. | |
|
173 | if settings['is_test']: | |
|
174 | utils.initialize_test_environment(settings_merged) | |
|
175 | ||
|
168 | 176 | includeme(config) |
|
169 | 177 | includeme_last(config) |
|
170 | 178 | pyramid_app = config.make_wsgi_app() |
@@ -73,6 +73,18 b' def initialize_database(config):' | |||
|
73 | 73 | init_model(engine, encryption_key=config['beaker.session.secret']) |
|
74 | 74 | |
|
75 | 75 | |
|
76 | def initialize_test_environment(settings, test_env=None): | |
|
77 | if test_env is None: | |
|
78 | test_env = not int(os.environ.get('RC_NO_TMP_PATH', 0)) | |
|
79 | ||
|
80 | from rhodecode.lib.utils import create_test_env, create_test_index | |
|
81 | from rhodecode.tests import TESTS_TMP_PATH | |
|
82 | # test repos | |
|
83 | if test_env: | |
|
84 | create_test_env(TESTS_TMP_PATH, settings) | |
|
85 | create_test_index(TESTS_TMP_PATH, settings, True) | |
|
86 | ||
|
87 | ||
|
76 | 88 | def get_vcs_server_protocol(config): |
|
77 | 89 | protocol = config.get('vcs.server.protocol', 'pyro4') |
|
78 | 90 | return protocol |
@@ -755,8 +755,8 b' def create_test_env(repos_test_path, con' | |||
|
755 | 755 | # PART TWO make test repo |
|
756 | 756 | log.debug('making test vcs repositories') |
|
757 | 757 | |
|
758 |
idx_path = config[' |
|
|
759 |
data_path = config[' |
|
|
758 | idx_path = config['search.location'] | |
|
759 | data_path = config['cache_dir'] | |
|
760 | 760 | |
|
761 | 761 | #clean index and data |
|
762 | 762 | if idx_path and os.path.exists(idx_path): |
@@ -787,7 +787,6 b' def create_test_env(repos_test_path, con' | |||
|
787 | 787 | tar.extractall(jn(TESTS_TMP_PATH, SVN_REPO)) |
|
788 | 788 | |
|
789 | 789 | |
|
790 | ||
|
791 | 790 | #============================================================================== |
|
792 | 791 | # PASTER COMMANDS |
|
793 | 792 | #============================================================================== |
General Comments 0
You need to be logged in to leave comments.
Login now