[PATCH] test python hook configured with python:[file]:[hook] syntax

Henri Wiechers hwiechers at gmail.com
Fri Jun 26 07:59:27 CDT 2009


# HG changeset patch
# User Henri Wiechers <hwiechers at gmail.com>
# Date 1246020125 -7200
# Node ID 26de3b168dc98518c9d7af1296a69ea469eb94d7
# Parent  7b3d837ca60e6e9fc84cdf92e64dedac41881f5d
test python hook configured with python:[file]:[hook] syntax

Adds a test for python hooks configured with python:[file]:[hook] syntax
in .hgrc. Increases the test coverage for mercurial/hook from 92% (79/85)
to 96% (82/85).

diff -r 7b3d837ca60e -r 26de3b168dc9 tests/test-hook
--- a/tests/test-hook	Thu Jun 25 09:23:33 2009 -0400
+++ b/tests/test-hook	Fri Jun 26 14:42:05 2009 +0200
@@ -230,4 +230,22 @@
 
 hg showconfig hooks | sed -e 's/ at .*>/>/'
 
+echo '# test python hook configured with python:[file]:[hook] syntax'
+cd ..
+mkdir d
+cd d
+hg init repo
+mkdir hooks
+
+cd hooks
+cat > testhooks.py <<EOF
+def testhook(**args):
+    print 'hook works'
+EOF
+echo '[hooks]' > ../repo/.hg/hgrc
+echo "pre-commit.test = python:`pwd`/testhooks.py:testhook" >> ../repo/.hg/hgrc
+
+cd ../repo
+hg commit
+
 exit 0
diff -r 7b3d837ca60e -r 26de3b168dc9 tests/test-hook.out
--- a/tests/test-hook.out	Thu Jun 25 09:23:33 2009 -0400
+++ b/tests/test-hook.out	Fri Jun 26 14:42:05 2009 +0200
@@ -160,3 +160,6 @@
 Automatically installed hook
 committed changeset 1:52998019f6252a2b893452765fcb0a47351a5708
 hooks.commit.auto=<function autohook>
+# test python hook configured with python:[file]:[hook] syntax
+hook works
+nothing changed


More information about the Mercurial-devel mailing list