Skip to content
Snippets Groups Projects
Commit ff8c0324 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

PyExamples test: output_idr as arg, not @-var

parent e5f4846c
No related branches found
No related tags found
No related merge requests found
...@@ -12,13 +12,12 @@ file(GLOB sim_examples ${PY_EXAMPLES_DIR}/sim*/*.py) ...@@ -12,13 +12,12 @@ file(GLOB sim_examples ${PY_EXAMPLES_DIR}/sim*/*.py)
file(GLOB fit_examples ${PY_EXAMPLES_DIR}/fit55_Specular/FitSpecularBasics.py) file(GLOB fit_examples ${PY_EXAMPLES_DIR}/fit55_Specular/FitSpecularBasics.py)
set(examples ${sim_examples} ${fit_examples}) set(examples ${sim_examples} ${fit_examples})
set(test_script ${output_dir}/check_functionality.py) set(test_script ${CMAKE_CURRENT_SOURCE_DIR}/check_functionality.py)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/check_functionality.in.py ${test_script} @ONLY)
foreach(example_path ${examples}) foreach(example_path ${examples})
get_filename_component(example_name ${example_path} NAME_WE) get_filename_component(example_name ${example_path} NAME_WE)
set(test_name PyExamples.${example_name}) set(test_name PyExamples.${example_name})
add_test(${test_name} add_test(${test_name}
env PYTHONPATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} env PYTHONPATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
${Python3_EXECUTABLE} ${test_script} ${example_path}) ${Python3_EXECUTABLE} ${test_script} ${example_path} ${output_dir})
endforeach() endforeach()
...@@ -13,8 +13,6 @@ import matplotlib ...@@ -13,8 +13,6 @@ import matplotlib
matplotlib.use('Agg') matplotlib.use('Agg')
from matplotlib import pyplot as plt from matplotlib import pyplot as plt
output_dir = "@output_dir@"
def get_figure(filename): def get_figure(filename):
""" """
...@@ -45,7 +43,7 @@ def exec_full(filepath): ...@@ -45,7 +43,7 @@ def exec_full(filepath):
exec(compile(file.read(), filepath, 'exec'), global_namespace) exec(compile(file.read(), filepath, 'exec'), global_namespace)
def run_example(filename): def run_example(filename, output_dir):
""" """
Tries to run python example and produce a *.png image Tries to run python example and produce a *.png image
""" """
...@@ -75,7 +73,7 @@ def run_example(filename): ...@@ -75,7 +73,7 @@ def run_example(filename):
if __name__ == '__main__': if __name__ == '__main__':
if len(sys.argv) != 2: if len(sys.argv) != 3:
exit("check_functionality called with wrong number of arguments") exit("Usage: check_functionality <script_to_test> <output_dir>")
run_example(sys.argv[1]) run_example(sys.argv[1], sys.argv[2])
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