diff --git a/Tests/Functional/Python/PyExamples/CMakeLists.txt b/Tests/Functional/Python/PyExamples/CMakeLists.txt index 54ae7fcc399309cd478b268c4a2550af5560daf6..f87ce6a9b5dc2c69cc2cd6ea33aad31e75810e57 100644 --- a/Tests/Functional/Python/PyExamples/CMakeLists.txt +++ b/Tests/Functional/Python/PyExamples/CMakeLists.txt @@ -6,15 +6,15 @@ # ############################################################################### -# add_custom_target(TempQtCreatorTarget SOURCES check_functionality.py) - file(GLOB sim_examples "${PY_EXAMPLES_DIR}/simulation/ex*/*.py") file(GLOB fit_examples "${PY_EXAMPLES_DIR}/fitting/ex09*/*.py") set(examples ${sim_examples} ${fit_examples}) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/check_functionality.py ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/check_functionality.py @ONLY) +set(output_dir ${TEST_OUTPUT_DIR}/Functional/Python/PyExamples) +set(test_script ${output_dir}/check_functionality.py) + +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/check_functionality.py ${test_script} @ONLY) -set(test_script ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/check_functionality.py) foreach(example ${examples}) set(script_path ${example}) diff --git a/Tests/Functional/Python/PyExamples/check_functionality.py b/Tests/Functional/Python/PyExamples/check_functionality.py index dc7e6460d584477f0ca736d53f419f85a87b465a..ce2283101183c091795252fcc570ea3e663bac1b 100644 --- a/Tests/Functional/Python/PyExamples/check_functionality.py +++ b/Tests/Functional/Python/PyExamples/check_functionality.py @@ -15,6 +15,8 @@ from matplotlib import pyplot as plt sys.path.append("@CMAKE_LIBRARY_OUTPUT_DIRECTORY@") +output_dir = "@output_dir@" + def get_figure(filename): """ Returns pyplot figure of appropriate size @@ -57,6 +59,7 @@ def run_example(filename): exec_full(filename) plot_file_name = os.path.splitext(os.path.basename(filename))[0] + ".png" + plot_file_name = os.path.join(output_dir, plot_file_name) print(plot_file_name) plt.savefig(plot_file_name, bbox_inches='tight') plt.close(fig) diff --git a/cmake/bornagain/modules/PyExamplesLineLength.cmake b/cmake/bornagain/modules/PyExamplesLineLength.cmake index 78f0d1324221945dff09dc5ec42ec0ec990f3bc1..60dbf1cb4f76a5c1172b351b33b3b5457ad3c2d1 100644 --- a/cmake/bornagain/modules/PyExamplesLineLength.cmake +++ b/cmake/bornagain/modules/PyExamplesLineLength.cmake @@ -1,13 +1,12 @@ -set(WEB_LEN_LIM 85) # maximum line length of code for display in Drupal web pages - # Check whether the line length of all python examples remains below WEB_LEN_LIM +set(WEB_LEN_LIM 85) # maximum line length of code for display + if(NOT MSVC) file(GLOB PY_EXAMPLES "${PY_EXAMPLES_DIR}/*/ex*/*.py") -add_test(NAME "PyExamplesLineLength" - COMMAND ${PYTHON_EXECUTABLE} +add_test(NAME "PyExamplesLineLength" COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/dev-tools/analyze/check-line-length.py ${WEB_LEN_LIM} ${PY_EXAMPLES})