changeset 9661:c4f6c02e33c4

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.
author Yuya Nishihara <yuya@tcha.org>
date Wed, 28 Oct 2009 23:59:18 +0900
parents e0eae93e6c67
children f3d60543924f 71e081b88f3e
files tests/test-extension tests/test-extension.out
diffstat 2 files changed, 25 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-extension	Wed Oct 28 23:55:23 2009 +0900
+++ b/tests/test-extension	Wed Oct 28 23:59:18 2009 +0900
@@ -75,6 +75,20 @@
 # 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
 
--- a/tests/test-extension.out	Wed Oct 28 23:55:23 2009 +0900
+++ b/tests/test-extension.out	Wed Oct 28 23:59:18 2009 +0900
@@ -24,6 +24,17 @@
 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