test-backend: Remove generate_fixtures option.

We remove the `generate_fixtures` option here mostly
for simplicity, but in particular to facilitate
an upcoming commit to simplify the job of
`generate-fixtures` (and remove its `--force` option).

The command line option here for `test-backend`
was really calling `generate_fixtures --force`,
which we're about to rename `tools/rebuild-test-database`.

The `test-backend` tools is already smart about catching
up on migrations, so we generally don't need to tell it
to repair the database.

And if the database does get corrupt, you can just do
it directly with `tools/rebuild-test-database`.

This eliminates the `use_force` flag in
`update_test_databases_if_required`, which was easy
to confuse with `rebuild_test_database`.

The other caller wasn't using `use_force`.
This commit is contained in:
Steve Howell 2020-04-21 21:04:42 +00:00 committed by Tim Abbott
parent 23f09fadfa
commit 239474124e
2 changed files with 3 additions and 9 deletions

View File

@ -238,9 +238,6 @@ def main() -> None:
action="store_true",
default=False,
help="Show detailed output")
parser.add_argument('--generate-fixtures', action="store_true", default=False,
dest="generate_fixtures",
help=("Force a call to generate-fixtures."))
parser.add_argument('--report-slow-tests', dest='report_slow_tests',
action="store_true",
default=False,
@ -377,7 +374,7 @@ def main() -> None:
# files, since part of setup is importing the models for all applications in INSTALLED_APPS.
django.setup()
update_test_databases_if_required(options.generate_fixtures)
update_test_databases_if_required()
subprocess.check_call(['tools/webpack', '--test'])

View File

@ -202,8 +202,7 @@ TEST_DATABASE = Database(
settings='zproject.test_settings',
)
def update_test_databases_if_required(use_force: bool=False,
rebuild_test_database: bool=False) -> None:
def update_test_databases_if_required(rebuild_test_database: bool=False) -> None:
"""Checks whether the zulip_test_template database template, is
consistent with our database migrations; if not, it updates it
in the fastest way possible:
@ -219,12 +218,10 @@ def update_test_databases_if_required(use_force: bool=False,
The `rebuild_test_database` option (used by our Casper tests) asks
us to drop and re-cloning the zulip_test database from the
template so those test suites can run with a fresh copy.
If use_force is specified, it will always do a full rebuild.
"""
test_template_db_status = TEST_DATABASE.template_status()
if use_force or test_template_db_status == 'needs_rebuild':
if test_template_db_status == 'needs_rebuild':
run(['tools/rebuild-dev-database'])
return