[PATCH 2 of 2] hgweb: added test case for extension loading phases (issue1824)

Yuya Nishihara yuya at tcha.org
Wed Oct 28 10:01:15 CDT 2009


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1256741958 -32400
# Node ID e18baa1ee1e117009ff2b7a4c5c51ccf17b0ab11
# Parent  045a62cbff4c5533f3aedf431f33ab1ab1411b90
hgweb: added test case for extension loading phases (issue1824)

this checks the order of module loading phases of hgweb.

`4) reposetup' lines are duplicated because hgweb calls
hg.repository() twice, one by __init__, another by refresh.

diff --git a/tests/test-extension b/tests/test-extension
--- a/tests/test-extension
+++ b/tests/test-extension
@@ -75,6 +75,20 @@ echo 'bar = bar.py' >> $HGRCPATH
 # command with no output, we just want to see the extensions loaded
 hg paths
 
+# check hgweb's load order
+echo '% hgweb.cgi'
+cat > hgweb.cgi <<EOF
+#!/usr/bin/env python
+from mercurial import demandimport; demandimport.enable()
+from mercurial.hgweb import hgweb
+from mercurial.hgweb import wsgicgi
+
+application = hgweb('.', 'test repo')
+wsgicgi.launch(application)
+EOF
+SCRIPT_NAME='/' SERVER_PORT='80' SERVER_NAME='localhost' python hgweb.cgi \
+    | grep '^[[:digit:]]) [[:alnum:] ]*$'  # ignores HTML output
+
 echo 'foo = !' >> $HGRCPATH
 echo 'bar = !' >> $HGRCPATH
 
diff --git a/tests/test-extension.out b/tests/test-extension.out
--- a/tests/test-extension.out
+++ b/tests/test-extension.out
@@ -24,6 +24,17 @@ 3) foo extsetup
 3) bar extsetup
 4) foo reposetup
 4) bar reposetup
+% hgweb.cgi
+1) foo imported
+1) bar imported
+2) foo uisetup
+2) bar uisetup
+3) foo extsetup
+3) bar extsetup
+4) foo reposetup
+4) bar reposetup
+4) foo reposetup
+4) bar reposetup
 empty extension - empty cmdtable
 
 no commands defined


More information about the Mercurial-devel mailing list