mirror of https://github.com/zulip/zulip.git
testing: Don't create DB twice for backend.
In backend tests, only call generate-fixtures when --generate-fixtures is explicitly passed or is_template_database_current() returns False. We don't need to flush cache for backend tests because we bounce the key prefix used to create cache keys before running every test
This commit is contained in:
parent
e23b660ccc
commit
bf713bcdfe
|
@ -172,10 +172,9 @@ if __name__ == "__main__":
|
||||||
action="store_true",
|
action="store_true",
|
||||||
default=False,
|
default=False,
|
||||||
help="Show detailed output")
|
help="Show detailed output")
|
||||||
parser.add_option('--no-generate-fixtures', action="store_false", default=True,
|
parser.add_option('--generate-fixtures', action="store_true", default=False,
|
||||||
dest="generate_fixtures",
|
dest="generate_fixtures",
|
||||||
help=("Reduce running time by not calling generate-fixtures. "
|
help=("Force a call to generate-fixtures."))
|
||||||
"This may cause spurious failures for some tests."))
|
|
||||||
parser.add_option('--report-slow-tests', dest='report_slow_tests',
|
parser.add_option('--report-slow-tests', dest='report_slow_tests',
|
||||||
action="store_true",
|
action="store_true",
|
||||||
default=False,
|
default=False,
|
||||||
|
@ -283,11 +282,9 @@ if __name__ == "__main__":
|
||||||
# files, since part of setup is importing the models for all applications in INSTALLED_APPS.
|
# files, since part of setup is importing the models for all applications in INSTALLED_APPS.
|
||||||
django.setup()
|
django.setup()
|
||||||
|
|
||||||
if options.generate_fixtures:
|
if options.generate_fixtures or not is_template_database_current():
|
||||||
generate_fixtures_command = [os.path.join(TOOLS_DIR, 'setup', 'generate-fixtures')]
|
generate_fixtures_command = [os.path.join(TOOLS_DIR, 'setup', 'generate-fixtures')]
|
||||||
if not is_template_database_current():
|
generate_fixtures_command.append('--force')
|
||||||
generate_fixtures_command.append('--force')
|
|
||||||
|
|
||||||
subprocess.call(generate_fixtures_command)
|
subprocess.call(generate_fixtures_command)
|
||||||
|
|
||||||
TestRunner = get_runner(settings)
|
TestRunner = get_runner(settings)
|
||||||
|
|
Loading…
Reference in New Issue