mirror of
https://github.com/zulip/zulip.git
synced 2025-10-25 00:53:56 +00:00
refactor: Early-exit in update_test_databases_if_required.
Just make each conditional run what it needs to run. The simplicity that this provides will be more apparent soon.
This commit is contained in:
@@ -224,13 +224,19 @@ def update_test_databases_if_required(use_force: bool=False,
|
||||
"""
|
||||
generate_fixtures_command = ['tools/setup/generate-fixtures']
|
||||
test_template_db_status = TEST_DATABASE.template_status()
|
||||
|
||||
if use_force or test_template_db_status == 'needs_rebuild':
|
||||
generate_fixtures_command.append('--force')
|
||||
elif test_template_db_status == 'run_migrations':
|
||||
TEST_DATABASE.run_db_migrations()
|
||||
elif not rebuild_test_database:
|
||||
subprocess.check_call(generate_fixtures_command)
|
||||
return
|
||||
subprocess.check_call(generate_fixtures_command)
|
||||
|
||||
if test_template_db_status == 'run_migrations':
|
||||
TEST_DATABASE.run_db_migrations()
|
||||
subprocess.check_call(generate_fixtures_command)
|
||||
return
|
||||
|
||||
if rebuild_test_database:
|
||||
subprocess.check_call(generate_fixtures_command)
|
||||
|
||||
def get_migration_status(**options: Any) -> str:
|
||||
verbosity = options.get('verbosity', 1)
|
||||
|
||||
Reference in New Issue
Block a user