diff --git a/.github/workflows/test_examples.yml b/.github/workflows/test_examples.yml index 2d8c90ddc..dc37663e2 100644 --- a/.github/workflows/test_examples.yml +++ b/.github/workflows/test_examples.yml @@ -48,6 +48,8 @@ jobs: f=(${file//// }) f=${f[1]} f=(${f//./}) + finalFile="$runfolder"/"$f".py + echo "convert notebook $file to script $finalFile" jupyter nbconvert --to python "$file" --stdout | grep -v -e "^get_ipython" > "$runfolder"/"$f".py fi done @@ -57,9 +59,8 @@ jobs: runfolder: "notebook_run" run: | cd "$runfolder" - python3 -c "from sys import path; print(path)" - python3 -c "from crpropa import c_light" - for file in ./*.py; do + ls + for file in *.py; do if [ -f "$file" ]; then python3 "$file" fi diff --git a/doc/pages/example_notebooks/basics/failing.ipynb b/doc/pages/example_notebooks/basics/failing.ipynb new file mode 100644 index 000000000..ecb70d9b8 --- /dev/null +++ b/doc/pages/example_notebooks/basics/failing.ipynb @@ -0,0 +1,53 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "ename": "RuntimeError", + "evalue": "this notebook should not succeed", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mRuntimeError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m/home/home1/jdo/CRPropa3/doc/pages/example_notebooks/basics/faining.ipynb Zelle 1\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[39mraise\u001b[39;00m \u001b[39mRuntimeError\u001b[39;00m(\u001b[39m\"\u001b[39m\u001b[39mthis notebook should not succeed\u001b[39m\u001b[39m\"\u001b[39m)\n", + "\u001b[0;31mRuntimeError\u001b[0m: this notebook should not succeed" + ] + } + ], + "source": [ + "raise RuntimeError(\"this notebook should not succeed\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.2" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}