-
Notifications
You must be signed in to change notification settings - Fork 452
Expand file tree
/
Copy pathrun_examples.sh
More file actions
executable file
·31 lines (25 loc) · 847 Bytes
/
run_examples.sh
File metadata and controls
executable file
·31 lines (25 loc) · 847 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
# Run the examples. Doesn't run Jupyter notebooks.
# The examples must cooperate: they must have no operations that wait
# on user action, like matplotlib.pyplot.show, or starting a GUI event
# loop. Environment variable PYCONTROL_TEST_EXAMPLES is set when the
# examples are being tested; existence of this variable should be used
# to prevent such user-action-waiting operations.
export PYCONTROL_TEST_EXAMPLES=1
example_errors=""
for example in *.py; do
echo "Running ${example}"
if ! python ${example}; then
example_errors="${example_errors} ${example}"
fi
done
# Get rid of the output files
rm *.log
# List any files that generated errors
if [ -n "${example_errors}" ]; then
echo These examples had errors:
echo "${example_errors}"
exit 1
else
echo All examples ran successfully
fi