You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_python-commits@quetz.apache.org by nl...@apache.org on 2005/01/20 18:08:02 UTC

svn commit: r125792 - /httpd/mod_python/trunk/test/htdocs/tests.py /httpd/mod_python/trunk/test/httpdconf.py /httpd/mod_python/trunk/test/test.py

Author: nlehuen
Date: Thu Jan 20 09:08:01 2005
New Revision: 125792

URL: http://svn.apache.org/viewcvs?view=rev&rev=125792
Log:
Added a test for PythonInterpPerDirective.
Modified:
   httpd/mod_python/trunk/test/htdocs/tests.py
   httpd/mod_python/trunk/test/httpdconf.py
   httpd/mod_python/trunk/test/test.py

Modified: httpd/mod_python/trunk/test/htdocs/tests.py
Url: http://svn.apache.org/viewcvs/httpd/mod_python/trunk/test/htdocs/tests.py?view=diff&rev=125792&p1=httpd/mod_python/trunk/test/htdocs/tests.py&r1=125791&p2=httpd/mod_python/trunk/test/htdocs/tests.py&r2=125792
==============================================================================
--- httpd/mod_python/trunk/test/htdocs/tests.py	(original)
+++ httpd/mod_python/trunk/test/htdocs/tests.py	Thu Jan 20 09:08:01 2005
@@ -820,6 +820,10 @@
     req.write(str(options))
     return apache.OK
 
+def interpreter(req):
+    req.write(req.interpreter)
+    return apache.OK
+
 def _test_table():
 
     log = apache.log_error

Modified: httpd/mod_python/trunk/test/httpdconf.py
Url: http://svn.apache.org/viewcvs/httpd/mod_python/trunk/test/httpdconf.py?view=diff&rev=125792&p1=httpd/mod_python/trunk/test/httpdconf.py&r1=125791&p2=httpd/mod_python/trunk/test/httpdconf.py&r2=125792
==============================================================================
--- httpd/mod_python/trunk/test/httpdconf.py	(original)
+++ httpd/mod_python/trunk/test/httpdconf.py	Thu Jan 20 09:08:01 2005
@@ -252,6 +252,14 @@
     def __init__(self, val):
         Directive.__init__(self, self.__class__.__name__, val)
 
+class PythonInterpPerDirectory(Directive):
+    def __init__(self, val='Off'):
+        Directive.__init__(self, self.__class__.__name__, val)
+
+class PythonInterpPerDirective(Directive):
+    def __init__(self, val='Off'):
+        Directive.__init__(self, self.__class__.__name__, val)
+
 class VirtualHost(ContainerTag):
     def __init__(self, addr, *args):
         ContainerTag.__init__(self, self.__class__.__name__, addr, args)

Modified: httpd/mod_python/trunk/test/test.py
Url: http://svn.apache.org/viewcvs/httpd/mod_python/trunk/test/test.py?view=diff&rev=125792&p1=httpd/mod_python/trunk/test/test.py&r1=125791&p2=httpd/mod_python/trunk/test/test.py&r2=125792
==============================================================================
--- httpd/mod_python/trunk/test/test.py	(original)
+++ httpd/mod_python/trunk/test/test.py	Thu Jan 20 09:08:01 2005
@@ -715,6 +715,30 @@
         if (rsp != "[('PythonOptionTest2', 'new_value2'), ('PythonOptionTest3', 'new_value3')]"):
             self.fail(`rsp`)
 
+    def test_interpreter_per_directive_conf(self):
+
+        c = VirtualHost("*",
+                        ServerName("test_interpreter_per_directive"),
+                        DocumentRoot(DOCUMENT_ROOT),
+                        Directory(DOCUMENT_ROOT,
+                                  PythonInterpPerDirective('On'),
+                                  SetHandler("mod_python"),
+                                  PythonHandler("tests::interpreter"),
+                                  PythonDebug("On")))
+
+        return str(c)
+
+    def test_interpreter_per_directive(self):
+
+        print "\n  * Testing interpreter per directive"
+
+        rsp = self.vhost_get("test_interpreter_per_directive")
+
+        interpreter_name = DOCUMENT_ROOT.replace('\\','/')+'/'
+        
+        if (rsp != interpreter_name):
+            self.fail(`rsp`)
+
     def test_util_fieldstorage_conf(self):
 
         c = VirtualHost("*",
@@ -1133,6 +1157,7 @@
         perRequestSuite.addTest(PerRequestTestCase("test_Session_Session"))
         # this must be last so its error_log is not overwritten
         perRequestSuite.addTest(PerRequestTestCase("test_internal"))
+        perRequestSuite.addTest(PerRequestTestCase("test_interpreter_per_directive"))
 
         self.makeConfig(PerRequestTestCase.appendConfig)
         self.startHttpd()