From 6daa9a2107844ce99403a8810ecbbab28fcf95d3 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Tue, 8 Dec 2020 21:08:05 +0100 Subject: [PATCH] tch-plot: activate short vs full mode --- .../Python/PyExamples/CMakeLists.txt | 2 +- devtools/code-tools/batch-plot.py | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Tests/Functional/Python/PyExamples/CMakeLists.txt b/Tests/Functional/Python/PyExamples/CMakeLists.txt index 7361798b926..4b3c7629b43 100644 --- a/Tests/Functional/Python/PyExamples/CMakeLists.txt +++ b/Tests/Functional/Python/PyExamples/CMakeLists.txt @@ -25,5 +25,5 @@ foreach(example_path ${examples}) set(test_name PyExamples.${example_name}) add_test(${test_name} env PYTHONPATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} - ${Python3_EXECUTABLE} ${test_script} ${example_path} ${output_dir}) + ${Python3_EXECUTABLE} ${test_script} -s ${example_path} ${output_dir}) endforeach() diff --git a/devtools/code-tools/batch-plot.py b/devtools/code-tools/batch-plot.py index 352810e4370..1059d28d19a 100755 --- a/devtools/code-tools/batch-plot.py +++ b/devtools/code-tools/batch-plot.py @@ -36,7 +36,7 @@ def reduce_nbin(t): m = re.match(pat, l) if m: oldsize = int(m.group(3)) - newsize = max(7, oldsize//20) + newsize = min(10, oldsize) lout = re.sub(pat, m.group(1)+f'{newsize}', l) else: lout = l @@ -44,7 +44,7 @@ def reduce_nbin(t): return '\n'.join(ret) -def run_example(filename, output_dir): +def run_example(mode_short, filename, output_dir): """ Tries to run python example and produce a *.png image """ @@ -63,8 +63,7 @@ def run_example(filename, output_dir): figsize = (640/72, 480/72) fig = plt.figure(figsize=(figsize[0], figsize[1])) - # In -s mode, reduce detector size. - if True: + if mode_short: script = reduce_nbin(script) # Run modified script. @@ -89,7 +88,13 @@ def run_example(filename, output_dir): if __name__ == '__main__': - if len(sys.argv) != 3: - exit("Usage: check_functionality <script_to_test> <output_dir>") + if len(sys.argv) != 4: + exit("Usage: check_functionality -s|-f <script_to_test> <output_dir>") + if sys.argv[1]=='-s': + mode_short = True + elif sys.argv[1]=='-f': + mode_short = False + else: + exit("Use flag -s|-f for short or long runs") - run_example(sys.argv[1], sys.argv[2]) + run_example(mode_short, sys.argv[2], sys.argv[3]) -- GitLab