From b2f22ecb61b415fc9f01d8cbf60b81a3c5ba8566 Mon Sep 17 00:00:00 2001
From: Michael Kuron <mkuron@icp.uni-stuttgart.de>
Date: Thu, 23 Jan 2020 13:30:05 +0100
Subject: [PATCH] more dependency fixes for tests

---
 .../01_tutorial_getting_started.ipynb         |  2 +-
 .../demo_plotting_and_animation.ipynb         | 32 +++++++++++++------
 doc/notebooks/demo_wave_equation.ipynb        |  7 ++--
 3 files changed, 28 insertions(+), 13 deletions(-)

diff --git a/doc/notebooks/01_tutorial_getting_started.ipynb b/doc/notebooks/01_tutorial_getting_started.ipynb
index 8ae0745ee..0d5e83787 100644
--- a/doc/notebooks/01_tutorial_getting_started.ipynb
+++ b/doc/notebooks/01_tutorial_getting_started.ipynb
@@ -943,7 +943,7 @@
     "    plt.imshow(img);\n",
     "except ImportError:\n",
     "    print(\"No requests installed\")\n",
-    "    img = None"
+    "    img = np.random.random((82, 290, 4))"
    ]
   },
   {
diff --git a/doc/notebooks/demo_plotting_and_animation.ipynb b/doc/notebooks/demo_plotting_and_animation.ipynb
index 07c980788..732f33bd0 100644
--- a/doc/notebooks/demo_plotting_and_animation.ipynb
+++ b/doc/notebooks/demo_plotting_and_animation.ipynb
@@ -408,9 +408,12 @@
     }
    ],
    "source": [
-    "plt.figure()\n",
-    "animation = plt.scalar_field_animation(run_func, frames=60)\n",
-    "ps.jupyter.display_as_html_video(animation)"
+    "if shutil.which(\"ffmpeg\") is not None:\n",
+    "    plt.figure()\n",
+    "    animation = plt.scalar_field_animation(run_func, frames=60)\n",
+    "    ps.jupyter.display_as_html_video(animation)\n",
+    "else:\n",
+    "    print(\"No ffmpeg installed\")"
    ]
   },
   {
@@ -474,8 +477,11 @@
     }
    ],
    "source": [
-    "animation = plt.surface_plot_animation(run_func, frames=60)\n",
-    "ps.jupyter.display_as_html_video(animation)"
+    "if shutil.which(\"ffmpeg\") is not None:\n",
+    "    animation = plt.surface_plot_animation(run_func, frames=60)\n",
+    "    ps.jupyter.display_as_html_video(animation)\n",
+    "else:\n",
+    "    print(\"No ffmpeg installed\")"
    ]
   },
   {
@@ -636,9 +642,12 @@
     }
    ],
    "source": [
-    "plt.figure()\n",
-    "animation = plt.vector_field_animation(run_func, frames=60)\n",
-    "ps.jupyter.display_as_html_video(animation)"
+    "if shutil.which(\"ffmpeg\") is not None:\n",
+    "    plt.figure()\n",
+    "    animation = plt.vector_field_animation(run_func, frames=60)\n",
+    "    ps.jupyter.display_as_html_video(animation)\n",
+    "else:\n",
+    "    print(\"No ffmpeg installed\")"
    ]
   },
   {
@@ -671,8 +680,11 @@
     }
    ],
    "source": [
-    "animation = plt.vector_field_magnitude_animation(run_func, frames=60)\n",
-    "ps.jupyter.display_as_html_video(animation)"
+    "if shutil.which(\"ffmpeg\") is not None:\n",
+    "    animation = plt.vector_field_magnitude_animation(run_func, frames=60)\n",
+    "    ps.jupyter.display_as_html_video(animation)\n",
+    "else:\n",
+    "    print(\"No ffmpeg installed\")"
    ]
   },
   {
diff --git a/doc/notebooks/demo_wave_equation.ipynb b/doc/notebooks/demo_wave_equation.ipynb
index 007e9a7b5..2aa083d96 100644
--- a/doc/notebooks/demo_wave_equation.ipynb
+++ b/doc/notebooks/demo_wave_equation.ipynb
@@ -471,9 +471,12 @@
     "            u_arrays[0], u_arrays[1], u_arrays[2] = u_arrays[1], u_arrays[2], u_arrays[0]\n",
     "        return u_arrays[2]\n",
     "    \n",
-    "    ani = plt.surface_plot_animation(run_LLVM, zlim=(-1, 1))\n",
     "    assert np.isfinite(np.max(u_arrays[2]))\n",
-    "ps.jupyter.display_as_html_video(ani)"
+    "    if shutil.which(\"ffmpeg\") is not None:\n",
+    "        ani = plt.surface_plot_animation(run_LLVM, zlim=(-1, 1))\n",
+    "        ps.jupyter.display_as_html_video(ani)\n",
+    "    else:\n",
+    "        print(\"No ffmpeg installed\")"
    ]
   },
   {
-- 
GitLab