mirror of https://github.com/zulip/zulip.git
Run django.setup() after coverage.start() in tests to fix coverage report.
Fixes #1007.
This commit is contained in:
parent
2640cc44c7
commit
f68a392250
|
@ -25,7 +25,6 @@ if __name__ == "__main__":
|
||||||
os.environ['DJANGO_SETTINGS_MODULE'] = 'zproject.test_settings'
|
os.environ['DJANGO_SETTINGS_MODULE'] = 'zproject.test_settings'
|
||||||
# "-u" uses unbuffered IO, which is important when wrapping it in subprocess
|
# "-u" uses unbuffered IO, which is important when wrapping it in subprocess
|
||||||
os.environ['PYTHONUNBUFFERED'] = 'y'
|
os.environ['PYTHONUNBUFFERED'] = 'y'
|
||||||
django.setup()
|
|
||||||
|
|
||||||
parser = optparse.OptionParser()
|
parser = optparse.OptionParser()
|
||||||
parser.add_option('--nonfatal-errors', action="store_false", default=True,
|
parser.add_option('--nonfatal-errors', action="store_false", default=True,
|
||||||
|
@ -63,6 +62,10 @@ if __name__ == "__main__":
|
||||||
prof = cProfile.Profile()
|
prof = cProfile.Profile()
|
||||||
prof.enable()
|
prof.enable()
|
||||||
|
|
||||||
|
# setup() needs to be called after coverage is started to get proper coverage reports of model
|
||||||
|
# files, since part of setup is importing the models for all applications in INSTALLED_APPS.
|
||||||
|
django.setup()
|
||||||
|
|
||||||
subprocess.call(os.path.join(TOOLS_DIR, 'setup', 'generate-fixtures'))
|
subprocess.call(os.path.join(TOOLS_DIR, 'setup', 'generate-fixtures'))
|
||||||
|
|
||||||
TestRunner = get_runner(settings)
|
TestRunner = get_runner(settings)
|
||||||
|
|
Loading…
Reference in New Issue