Skip to content
Snippets Groups Projects
Commit 99a621c2 authored by Pospelov, Gennady's avatar Pospelov, Gennady
Browse files

Exception throw message added to PyExamples; all simulation examples included.

parent 8211a237
No related branches found
No related tags found
No related merge requests found
...@@ -8,21 +8,17 @@ ...@@ -8,21 +8,17 @@
add_custom_target(TempQtCreatorTarget SOURCES check_functionality.py) add_custom_target(TempQtCreatorTarget SOURCES check_functionality.py)
set(examples
simulation/ex01_BasicParticles/CylindersAndPrisms
)
file(GLOB examples "${PY_EXAMPLES_DIR}/simulation/ex*/*.py")
set(test_script ${CMAKE_SOURCE_DIR}/Tests/Functional/PyExamples/check_functionality.py) set(test_script ${CMAKE_SOURCE_DIR}/Tests/Functional/PyExamples/check_functionality.py)
foreach(example ${examples}) foreach(example ${examples})
set(script_path ${PY_EXAMPLES_DIR}/${example}.py) set(script_path ${example})
get_filename_component(script_name ${script_path} NAME_WE) get_filename_component(script_name ${script_path} NAME_WE)
set(test_name PyExamples/${script_name}) set(test_name PyExamples/${script_name})
add_test(${test_name} ${PYTHON_EXECUTABLE} ${test_script} ${script_path}) add_test(${test_name} ${PYTHON_EXECUTABLE} ${test_script} ${script_path})
set_tests_properties(${test_name} PROPERTIES LABELS "Examples") set_tests_properties(${test_name} PROPERTIES LABELS "Examples")
message(INFO "XXX ${PYTHON_EXECUTABLE} ${test_script} ${script_path}")
endforeach() endforeach()
...@@ -46,6 +46,9 @@ def run_example(filename): ...@@ -46,6 +46,9 @@ def run_example(filename):
""" """
Tries to run python example and produce a *.png image Tries to run python example and produce a *.png image
""" """
if not os.path.exists(filename):
raise Exception("File '"+filename+"' doesn't exist.")
print(filename) print(filename)
fig = get_figure(filename) fig = get_figure(filename)
...@@ -64,10 +67,13 @@ def run_example(filename): ...@@ -64,10 +67,13 @@ def run_example(filename):
status = "EMPTY?" status = "EMPTY?"
except: except:
e = sys.exc_info()[0]
print("Error {0} while trying to execute '{1}'".format(e, filename))
status = "FAILED" status = "FAILED"
print(status) print(status)
# return os.path.join(dirname, filename), status, "" if status != "OK":
raise Exception(status)
if __name__ == '__main__': if __name__ == '__main__':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment