[mod_python] Running mod_python tests

Graham Dumpleton graham.dumpleton at gmail.com
Mon Oct 8 19:23:43 EDT 2007


You need to actually install mod_python properly. Symlinking the
lib/python/mod_python directory into site-packages is not enough as
the _pspmodule.so file isn't copied into the correct location until an
install is done.

Graham

On 09/10/2007, Dorneles Treméa <dorneles at x3ng.com.br> wrote:
> Hello folks,
>
> I'm trying to run the mod_python tests but I hit a few problems,
> specifically I got one error and three failing tests.
>
> 1) My environment:
>
> Ubuntu Gutsy
> Python 2.5.1
> Apache 2.2.4
>
> 2) What I did:
>
> sudo apt-get install apache2 apache2-dev
> cd /tmp
> wget
> http://mirrors.uol.com.br/pub/apache/httpd/modpython/mod_python-3.3.1.tgz
> tar zxf mod_python-3.3.1.tgz
> cd mod_python-3.3.1; ./configure; make
> cd /usr/lib/python2.5/site-packages
> sudo ln -s /tmp/mod_python-3.3.1/lib/python/mod_python
> cd -
> python test/test.py
>
> 3) The tests results:
>
> ======================================================================
> FAIL: test_psphandler (__main__.PerRequestTestCase)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "test/test.py", line 1847, in test_psphandler
>     self.fail(`rsp`)
> AssertionError: '\n<pre>\nMOD_PYTHON ERROR\n\nProcessId:
> 21114\nInterpreter:    \'test_psphandler\'\n\nServerName:
> \'test_psphandler\'\nDocumentRoot:
> \'/home/dorneles/src/mod_python-3.3.1/test/htdocs\'\n\nURI:
>  \'/psptest.psp\'\nLocation:       None\nDirectory:
> \'/home/dorneles/src/mod_python-3.3.1/test/htdocs/\'\nFilename:
> \'/home/dorneles/src/mod_python-3.3.1/test/htdocs/psptest.psp\'\nPathInfo:
>       \'\'\n\nPhase:          \'PythonHandler\'\nHandler:
> \'mod_python.psp\'\n\nTraceback (most recent call last):\n\n  File
> "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1537,
> in HandlerDispatch\n    default=default_handler, arg=req,
> silent=hlist.silent)\n\n  File
> "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1202,
> in _process_target\n    module = import_module(module_name,
> path=path)\n\n  File
> "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 304,
> in import_module\n    return __import__(module_name, {}, {},
> [\'*\'])\n\n  File
> "/usr/lib/python2.5/site-packages/mod_python/psp.py", line 21, in
> &lt;module&gt;\n    import apache, Session, util, _psp\n\nImportError:
> No module named _psp\n\n</pre>\n'
>
> ======================================================================
> FAIL: test_psp_error (__main__.PerRequestTestCase)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "test/test.py", line 1915, in test_psp_error
>     self.fail(`rsp`)
> AssertionError: '\n<pre>\nMOD_PYTHON ERROR\n\nProcessId:
> 21114\nInterpreter:    \'test_psp_error\'\n\nServerName:
> \'test_psp_error\'\nDocumentRoot:
> \'/home/dorneles/src/mod_python-3.3.1/test/htdocs\'\n\nURI:
>  \'/psptest_main.psp\'\nLocation:       None\nDirectory:
> \'/home/dorneles/src/mod_python-3.3.1/test/htdocs/\'\nFilename:
> \'/home/dorneles/src/mod_python-3.3.1/test/htdocs/psptest_main.psp\'\nPathInfo:
>       \'\'\n\nPhase:          \'PythonHandler\'\nHandler:
> \'mod_python.psp\'\n\nTraceback (most recent call last):\n\n  File
> "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1537,
> in HandlerDispatch\n    default=default_handler, arg=req,
> silent=hlist.silent)\n\n  File
> "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1202,
> in _process_target\n    module = import_module(module_name,
> path=path)\n\n  File
> "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 304,
> in import_module\n    return __import__(module_name, {}, {},
> [\'*\'])\n\n  File
> "/usr/lib/python2.5/site-packages/mod_python/psp.py", line 21, in
> &lt;module&gt;\n    import apache, Session, util, _psp\n\nImportError:
> No module named _psp\n\n</pre>\n'
>
> ======================================================================
> ERROR: test_apache_exists_config_define (__main__.PerInstanceTestCase)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "test/test.py", line 2794, in test_apache_exists_config_define
>     f = urllib.urlopen("http://127.0.0.1:%s/tests.py" % PORT)
>   File "urllib.py", line 82, in urlopen
>     return opener.open(url)
>   File "urllib.py", line 190, in open
>     return getattr(self, name)(url)
>   File "urllib.py", line 325, in open_http
>     h.endheaders()
>   File "httplib.py", line 856, in endheaders
>     self._send_output()
>   File "httplib.py", line 728, in _send_output
>     self.send(msg)
>   File "httplib.py", line 695, in send
>     self.connect()
>   File "httplib.py", line 679, in connect
>     raise socket.error, msg
> IOError: [Errno socket error] (111, 'Connection refused')
>
> ======================================================================
> FAIL: testPerRequestTests (__main__.PerInstanceTestCase)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "test/test.py", line 2710, in testPerRequestTests
>     self.failUnless(result.wasSuccessful())
> AssertionError
>
> 4) Questions
>
> a) Can someone confirm that some tests are really failing and/or
> that the problem is with my environment?
>
> b) Is there a way to run the tests without the need to add (or link)
> the mod_python package to Python site-packages directory?
>
> Any help is very welcome... :-)
>
> --
>
> Dorneles Treméa
> X3ng Web Technology
> http://nosleepforyou.blogspot.com
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>



More information about the Mod_python mailing list