Skip to content

Commit 6590890

Browse files
committed
QPR-11823 add a new test scripts for the notebooks
1 parent 0f50b25 commit 6590890

3 files changed

Lines changed: 23 additions & 7 deletions

File tree

Docker/Dockerfile-ORESWIG-App

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ RUN apt-get update \
1212
&& apt-get clean \
1313
&& rm -rf /var/lib/apt/lists/*
1414

15-
RUN pip3 install matplotlib pandas nose nose_xunitmp datacompy
15+
RUN pip3 install matplotlib pandas nose nose_xunitmp datacompy jupyter
1616

1717
WORKDIR /
1818
RUN mkdir /oreswig
@@ -37,6 +37,11 @@ COPY oreswig/QuantLib-SWIG/Python/test /oreswig/tests/QuantLibTestSuite
3737
RUN rm oreswig/tests/QuantLibTestSuite/__init__.py
3838
COPY oreswig/OREAnalytics-SWIG/Python/test /oreswig/tests/ORETestSuite
3939
COPY oreswig/OREAnalytics-SWIG/Python/Examples /oreswig/example_scripts
40+
# due to relative path imports in the notebooks, we need to copy utilities.py directly into the example folder
41+
RUN cp oreswig/example_scripts/Notebooks/utilities.py oreswig/example_scripts/Notebooks/Example_1
42+
RUN cp oreswig/example_scripts/Notebooks/utilities.py oreswig/example_scripts/Notebooks/Example_2
43+
RUN cp oreswig/example_scripts/Notebooks/utilities.py oreswig/example_scripts/Notebooks/Example_3
44+
RUN cp oreswig/example_scripts/Notebooks/utilities.py oreswig/example_scripts/Notebooks/Example_4
4045
COPY ore/Examples /oreswig/Examples
4146
COPY ore/Tools /oreswig/Tools
4247
# Set env variable to run the ore examples with the python interface instead of the executable

OREAnalytics-SWIG/Python/Examples/Notebooks/Example_1/Untitled.ipynb

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/sh
2+
status=0
3+
return_code=0
4+
for dir in $(find ./Notebooks -type d); do
5+
# Loop over all ipynb files in the current subdirectory
6+
for file in "$dir"/*.ipynb; do
7+
# Run nbconvert on the current ipynb file
8+
if test -f "$file"; then
9+
jupyter nbconvert --execute "$file" --to notebook --output-dir=./tmp
10+
return_code=$?
11+
if [ $return_code -gt $status ]; then
12+
status=$return_code
13+
fi
14+
fi
15+
done
16+
done
17+
exit $status

0 commit comments

Comments
 (0)