Skip to content
This repository was archived by the owner on Sep 3, 2022. It is now read-only.

Commit 371f28a

Browse files
authored
Fix the batch notebook tests (#36)
This makes the batch notebook tests pass again by excluding the recently added notebooks that are not meant to be run in a batch mode.
1 parent c2f36f9 commit 371f28a

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

.test.sh

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,36 @@
3636
# --workdir /content/notebooks \
3737
# gcr.io/cloud-datalab/datalab-gateway
3838

39+
EXCLUDE=(
40+
"Introduction to Python.ipynb"
41+
"2. Preprocess.ipynb"
42+
"3. Training.ipynb"
43+
"6. Evaluation and Batch Prediction.ipynb"
44+
"7. HyperParameter Tuning.ipynb"
45+
)
46+
3947
function testNotebooks() {
4048
DIR="${1:-./}"
4149
IFS=$'\n'
4250
FAILED_NOTEBOOKS=""
4351
SEP=$'\n\t'
4452
COUNT="0"
45-
for NOTEBOOK in `find ${DIR} -name '*.ipynb' -and -not -name 'Introduction to Python.ipynb'`; do
46-
echo "Testing ${NOTEBOOK}"
47-
jupyter nbconvert --ExecutePreprocessor.enabled=True --ExecutePreprocessor.timeout=300 "${NOTEBOOK}" || FAILED_NOTEBOOKS="${FAILED_NOTEBOOKS}${SEP}${NOTEBOOK}"
48-
COUNT=$(expr ${COUNT} + 1)
53+
EXCLUDE_ARGS=""
54+
for EXCLUDED_NOTEBOOK in "${EXCLUDE[@]}"; do
55+
EXCLUDE_ARGS="${EXCLUDE_ARGS} -and -not -name '${EXCLUDED_NOTEBOOK}'"
56+
done
57+
SEARCH_CMD="find ${DIR} -name '*.ipynb'${EXCLUDE_ARGS}"
58+
echo "Search command: ${SEARCH_CMD}"
59+
for NOTEBOOK in `eval "${SEARCH_CMD}"`; do
60+
echo "Testing ${NOTEBOOK}"
61+
jupyter nbconvert --ExecutePreprocessor.enabled=True --ExecutePreprocessor.timeout=300 "${NOTEBOOK}" || FAILED_NOTEBOOKS="${FAILED_NOTEBOOKS}${SEP}${NOTEBOOK}"
62+
COUNT=$(expr ${COUNT} + 1)
4963
done
5064
if [ -n "${FAILED_NOTEBOOKS}" ]; then
51-
echo "Validation failed for the following notebooks:${FAILED_NOTEBOOKS}"
52-
exit 1
65+
echo "Validation failed for the following notebooks:${FAILED_NOTEBOOKS}"
66+
exit 1
5367
else
54-
echo "Validation passed for ${COUNT} notebooks"
68+
echo "Validation passed for ${COUNT} notebooks"
5569
fi
5670
}
5771

0 commit comments

Comments
 (0)