test_fixtures: Refactor to have template_database_status API.

In this commit we are essentially just refactoring the function
is_template_database_current to be called template_database_status
and adjusting the return values accordingly.
This is essentially a preparatory commit for the upcoming commits
which will essentially enable us to not throw away entire DB and
rebuild from scratch if only running migrations could do the job.
This commit is contained in:
Aditya Bansal
2018-06-06 03:46:27 +05:30
committed by Tim Abbott
parent 53237d39aa
commit f7c11d1747
4 changed files with 25 additions and 19 deletions

View File

@@ -19,7 +19,7 @@ TOOLS_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if TOOLS_DIR not in sys.path:
sys.path.insert(0, os.path.dirname(TOOLS_DIR))
from zerver.lib.test_fixtures import is_template_database_current
from zerver.lib.test_fixtures import template_database_status
def set_up_django(external_host):
# type: (str) -> None
@@ -63,7 +63,8 @@ def test_server_running(force: bool=False, external_host: str='testserver',
if use_db:
generate_fixtures_command = ['tools/setup/generate-fixtures']
if not is_template_database_current():
test_template_db_status = template_database_status()
if test_template_db_status == 'needs_rebuild':
generate_fixtures_command.append('--force')
subprocess.check_call(generate_fixtures_command)