From 23f09fadfa0838cd54554942dd6713a199a4903c Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Tue, 21 Apr 2020 20:52:46 +0000 Subject: [PATCH] refactor: Use run in update_test_databases_if_required. Use `run` to run the tools, and take advantage that `rebuild-dev-database` is really the same as `generate-fixtures --force`. --- zerver/lib/test_fixtures.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/zerver/lib/test_fixtures.py b/zerver/lib/test_fixtures.py index 915b908c8f..a216b31e9d 100644 --- a/zerver/lib/test_fixtures.py +++ b/zerver/lib/test_fixtures.py @@ -222,21 +222,19 @@ def update_test_databases_if_required(use_force: bool=False, If use_force is specified, it will always do a full rebuild. """ - 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') - subprocess.check_call(generate_fixtures_command) + run(['tools/rebuild-dev-database']) return if test_template_db_status == 'run_migrations': TEST_DATABASE.run_db_migrations() - subprocess.check_call(generate_fixtures_command) + run(['tools/setup/generate-fixtures']) return if rebuild_test_database: - subprocess.check_call(generate_fixtures_command) + run(['tools/setup/generate-fixtures']) def get_migration_status(**options: Any) -> str: verbosity = options.get('verbosity', 1)