Tests: fix some tests passing even if there are Python errors

Blender was not configured to exit with non-zero return code on Python errors.
A bunch of tests worked around this but not all. This removes the need for such
workarounds.
This commit is contained in:
Brecht Van Lommel 2020-04-27 17:43:47 +02:00
parent a7bd835644
commit 6cab53eaaa
17 changed files with 19 additions and 123 deletions

View File

@ -27,7 +27,8 @@ endif()
# set(TEST_BLENDER_EXE valgrind --track-origins=yes --error-limit=no ${TEST_BLENDER_EXE})
# Standard Blender arguments for running tests.
set(TEST_BLENDER_EXE_PARAMS --background -noaudio --factory-startup)
# Specify exit code so that if a Python script error happens, the test fails.
set(TEST_BLENDER_EXE_PARAMS --background -noaudio --factory-startup --python-exit-code 1)
# Python CTests
if(WITH_BLENDER AND WITH_PYTHON)

View File

@ -176,9 +176,4 @@ def main():
if __name__ == "__main__":
try:
main()
except:
import traceback
traceback.print_exc()
sys.exit(1)
main()

View File

@ -375,12 +375,4 @@ def main():
if __name__ == "__main__":
import traceback
# So a python error exits Blender itself too
try:
main()
except SystemExit:
raise
except:
traceback.print_exc()
sys.exit(1)
main()

View File

@ -77,9 +77,4 @@ def main():
if __name__ == '__main__':
import sys
sys.argv = [__file__] + (sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else [])
try:
main()
except:
import traceback
traceback.print_exc()
sys.exit(1)
main()

View File

@ -75,9 +75,4 @@ def main():
if __name__ == '__main__':
import sys
sys.argv = [__file__] + (sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else [])
try:
main()
except:
import traceback
traceback.print_exc()
sys.exit(1)
main()

View File

@ -255,12 +255,4 @@ def main():
if __name__ == "__main__":
import traceback
# So a python error exits Blender itself too
try:
main()
except SystemExit:
raise
except:
traceback.print_exc()
sys.exit(1)
main()

View File

@ -144,11 +144,4 @@ def main():
if __name__ == "__main__":
# So a python error exits(1)
try:
main()
except:
import traceback
traceback.print_exc()
sys.exit(1)
main()

View File

@ -234,10 +234,4 @@ def main():
if __name__ == "__main__":
# So a python error exits(1)
try:
main()
except:
import traceback
traceback.print_exc()
sys.exit(1)
main()

View File

@ -842,17 +842,7 @@ if __name__ == "__main__":
print("Load Handler:", bpy.data.filepath)
if load_handler.first is False:
bpy.app.handlers.scene_update_post.remove(load_handler)
try:
main()
import sys
sys.exit(0)
except:
import traceback
traceback.print_exc()
# import sys
# sys.exit(1) # comment to debug
main()
else:
load_handler.first = False

View File

@ -152,10 +152,4 @@ def main():
if __name__ == "__main__":
# So a python error exits(1)
try:
main()
except:
import traceback
traceback.print_exc()
sys.exit(1)
main()

View File

@ -20,7 +20,6 @@ import bpy
import sys
import os
import tempfile
import traceback
import inspect
from bpy.types import UIList
@ -331,11 +330,4 @@ def main():
if __name__ == "__main__":
try:
main()
except:
import traceback
traceback.print_exc()
sys.stderr.flush()
os._exit(1)
main()

View File

@ -136,12 +136,7 @@ def main():
print(" Running: '%s'" % run)
print(" MD5: '%s'!" % md5)
try:
result = eval(run)
except:
import traceback
traceback.print_exc()
sys.exit(1)
result = eval(run)
if write_blend is not None:
print(" Writing Blend: %s" % write_blend)
@ -188,10 +183,4 @@ def main():
if __name__ == "__main__":
# So a python error exits(1)
try:
main()
except:
import traceback
traceback.print_exc()
sys.exit(1)
main()

View File

@ -60,9 +60,4 @@ def main():
if __name__ == "__main__":
try:
main()
except:
import traceback
traceback.print_exc()
sys.exit(1)
main()

View File

@ -255,9 +255,4 @@ def main():
if __name__ == "__main__":
try:
main()
except:
import traceback
traceback.print_exc()
sys.exit(1)
main()

View File

@ -163,10 +163,4 @@ def main():
if __name__ == "__main__":
try:
main()
except:
import traceback
traceback.print_exc()
sys.exit(1)
main()

View File

@ -48,9 +48,4 @@ def main():
if __name__ == "__main__":
try:
main()
except:
import traceback
traceback.print_exc()
sys.exit(1)
main()

View File

@ -48,9 +48,4 @@ def main():
if __name__ == "__main__":
try:
main()
except:
import traceback
traceback.print_exc()
sys.exit(1)
main()