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

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

Reviewers: mp+128356_code.launchpad.net,

Message:
Please take a look.

Description:
Add a tool to run tests automatically on change

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

https://code.launchpad.net/~clint-fewbar/juju/add-testrunner/+merge/128356

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/6624055/

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 @@
+#!/bin/bash
+# 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 .
+fi
+file=$1
+dir=`dirname $file`
+if [ "`basename $dir`" = "tests" ] ; then
+ testmod=${file//\//.}
+ testmod=${testmod%%.py}
+else
+ testmod=${dir//\//.}
+fi
+testmod=${testmod##..}
+echo $file changed, Running tests ... $testmod
+if eatmydata ./test $testmod ; then
+ exec notify-send -i terminal "$testmod PASSED"
+else
+ exec notify-send -u critical -i terminal "$testmod FAILED"
+fi

« Back to merge proposal