From 33e9ce9e844bd97d2ee87e2c09df0f658ec0970d Mon Sep 17 00:00:00 2001
From: Dilawar Singh <dilawars@ncbs.res.in>
Date: Wed, 12 Aug 2015 02:20:41 +0530
Subject: [PATCH] Script which runs all demo and snippets in non-blocking mode.

---
 data/matplotlibrc | 11 +++++++++++
 test_examples.sh  | 24 ++++++++++++++++++++++++
 2 files changed, 35 insertions(+)
 create mode 100644 data/matplotlibrc
 create mode 100755 test_examples.sh

diff --git a/data/matplotlibrc b/data/matplotlibrc
new file mode 100644
index 00000000..737f9d46
--- /dev/null
+++ b/data/matplotlibrc
@@ -0,0 +1,11 @@
+# This is configuration file for matplotlib used in examples. 
+# We use this configuration file to test the examples. Copy this configuration
+# file in the current working directory and run the snippet. 
+
+# This configuration file does the followings:
+# - plt.show() function become non-blocking.
+
+backend = qt4agg
+
+# This makes all plots non-blocking.
+interactive = True
diff --git a/test_examples.sh b/test_examples.sh
new file mode 100755
index 00000000..bfa9d9a4
--- /dev/null
+++ b/test_examples.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+set -e
+declare -i a
+PYC=`which python`
+RUNDIR=./_test_dir_moose-examples_
+echo "Creating $RUNDIR"
+mkdir -p $RUNDIR
+MATPLOTRC=data/matplotlibrc
+echo "copying examples out of source"
+cp -r moose-examples/* $RUNDIR/
+PYFILES=`find $RUNDIR -name "*.py"`
+for pyf in $PYFILES; do
+    let a=a+1
+    dn=`dirname $pyf`
+    fn=`basename $pyf`
+    # copy matplotlibrc file to working directory
+    cp $MATPLOTRC $dn/
+    (
+        cd $dn
+        echo "Executing $fn in directory $dn"
+        $PYC $fn
+    )
+done
+echo "Total $a scripts run"
-- 
GitLab