Code review comment for lp:~clint-fewbar/pyjuju/add-testrunner

Revision history for this message
Clint Byrum (clint-fewbar) wrote :


Please take a look.

Add a tool to run tests automatically on change

While developing, its quite helpful to have relevant run automatically
any changes. The script proposed here will do exactly that, using iwatch
(so it will only work on Linux systems).

(do not edit description out of merge proposal)

Please review this at

Affected files:
   A [revision details]
   A misc/devel-tools/test-watcher

Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: <email address hidden>
+New revision: <email address hidden>

Index: misc/devel-tools/test-watcher
=== added file 'misc/devel-tools/test-watcher'
--- misc/devel-tools/test-watcher 1970-01-01 00:00:00 +0000
+++ misc/devel-tools/test-watcher 2012-10-06 15:46:21 +0000
@@ -0,0 +1,25 @@
+# Author: Clint Byrum <email address hidden>
+# Run this script in a window and it will continuously monitor the
+# files in the current directory, and run the tests associated with
+# a change whenever they are written. It will also use notify-send
+# to let you know if tests passed or failed.
+if [ -z "$1" ] ; then
+ exec iwatch -r -t .*\.py$ -c "$0 %f" -x .bzr -e modify -v .
+dir=`dirname $file`
+if [ "`basename $dir`" = "tests" ] ; then
+ testmod=${file//\//.}
+ testmod=${}
+ testmod=${dir//\//.}
+echo $file changed, Running tests ... $testmod
+if eatmydata ./test $testmod ; then
+ exec notify-send -i terminal "$testmod PASSED"
+ exec notify-send -u critical -i terminal "$testmod FAILED"

« Back to merge proposal