[CherryPy] #801: cherrypy._cpwsgi.CPWSGIApp is incompatible with twill 0.9b1

0 views
Skip to first unread message

CherryPy

unread,
Mar 24, 2008, 3:16:55 PM3/24/08
to cherrypy...@googlegroups.com
#801: cherrypy._cpwsgi.CPWSGIApp is incompatible with twill 0.9b1
-------------------------------------+--------------------------------------
Reporter: mchapm...@gmail.com | Owner: rdelon
Type: defect | Status: new
Priority: normal | Milestone:
Component: CherryPy code | Keywords:
-------------------------------------+--------------------------------------
In trying to write nose/twill unit tests for a CherryPy 3 application, I
was unable to use cherrypy._cpwsgi.CPWSGIApp as the twill app-creation
function. My specific CherryPy application class worked fine as the app-
creation function.

Here's a script to demonstrate the problem.
{{{
#!/usr/bin/env python
# encoding: utf-8
import sys, logging, StringIO, twill, cherrypy
from twill import commands
from cherrypy._cpwsgi import CPWSGIApp

class DemoApp(object):
@cherrypy.expose
def index(self, *args, **kw):
return '''<html><head><title>Test</title></head>
<body><p>This is a test.</p></body>
</html>'''

class TestCase(object):
def setup(self):
siteSettings = {'server.environment': 'development',
'server.socket_port': 8080, 'log.screen': False}
cherrypy.config.update(siteSettings)
wsgi_app = cherrypy.tree.mount(DemoApp(), "/", {})
cherrypy.engine.start()

def getApp():
# return wsgi_app # This works.
return CPWSGIApp # This does not.

twill.add_wsgi_intercept('localhost', 8080, getApp)
self.outp = StringIO.StringIO()
twill.set_output(self.outp)

def teardown(self):
twill.remove_wsgi_intercept('localhost', 8080)
cherrypy.engine.stop()
logging.debug("Twill output:\n%s" % self.outp.getvalue())

def test1(self):
commands.go("http://localhost:8080/index")

def main():
logging.basicConfig(level=logging.DEBUG)

import nose
logging.debug("sys.platform: %s" % sys.platform)
logging.debug("Using CherryPy %s, twill %s, nose %s" %
(cherrypy.__version__, twill.__version__,
nose.__version__))
nose.main(defaultTest=__file__)

if __name__ == "__main__":
main()
}}}

When run with Python 2.5.2, CherryPy 3.1.0beta3, twill 0.9b1 and nose
0.10.1 on Mac OS X 10.5.2, this produces a traceback ending in
{{{
File ".../lib/python2.5/site-
packages/CherryPy-3.1b1-py2.5.egg/cherrypy/_cpwsgi.py", line 291, in
__init__
self.pipeline.extend(pipeline)
TypeError: 'function' object is not iterable
}}}

The problem was first observed with CherryPy 3.0.2.

--
Ticket URL: <http://www.cherrypy.org/ticket/801>
CherryPy <http://www.cherrypy.org>
CherryPy - a pythonic, object-oriented HTTP framework

CherryPy

unread,
Apr 26, 2008, 9:34:07 PM4/26/08
to cherrypy...@googlegroups.com
#801: cherrypy._cpwsgi.CPWSGIApp is incompatible with twill 0.9b1
-------------------------------------+--------------------------------------
Reporter: mchapm...@gmail.com | Owner: rdelon
Type: defect | Status: new
Priority: normal | Milestone:
Component: CherryPy code | Resolution:
Keywords: |
-------------------------------------+--------------------------------------
Comment (by fumanchu):

I don't see how. It would be nice to have the complete traceback.
Reply all
Reply to author
Forward
0 new messages