[Zope-dev] zope.testbrowser and WebTest (round 2)

Wolfgang Schnerring ws at gocept.com
Sat Feb 12 08:59:50 EST 2011


Hi,

sorry I'm replying this late. I've been busy, then sick, then busy
again, so I'm afraid this has got pushed low on my stack of stuff...

* Brian Sutherland <brian at vanguardistas.net> [2011-02-02 11:15]:
> On Tue, Feb 01, 2011 at 09:32:11AM +0100, Wolfgang Schnerring wrote:
>> * Brian Sutherland <brian at vanguardistas.net> [2011-01-31 09:54]:
>> > On Mon, Jan 31, 2011 at 07:02:35AM +0100, Wolfgang Schnerring wrote:
> Ok, I think that that API is preservable. However I would like to make
> the layer optional by adding an wsgi_app keyword argument to Browser. So
> you can do:
>
>     >>> browser = Browser(wsgi_app=app)
>
> where app is a WSGI application.
>
> Some people in the non-zope world are not too fond of layers, or use
> incompatible testrunners. We shouldn't force layers on them.

Yes, we definitely don't want to require layers here. This has not been
an issue so far, since both the publisher and the wsgi_intercept method
inject the application to the browser by looking it up via the special
hostname 'localhost', but now we need to pass in the WSGI callable
explicitly.

I do think that mostly one will want to prepare the WSGI callable only
once, and thus a layer is a good fit, but that should be optional.

>> I'd prefer if we treated this as two separate steps, then:
>> a) improve the testbrwoser+wsgi story by replacing wsgi_intercept with WebTest
>> b) extract the testbrowser part that talks to the Publisher
>
> Initially I did them together because it was the only way to get very
> good test coverage of the WebTest integration. If we do it this way,
> between steps a and b we'll have poor coverate. But that's not so bad as
> the code has already been well tested on my current branch.
>  
>> As to (a), I'll still need to look at your code, but as I said I'm
>> all in favour of using WebTest instead of wsgi_intercept.
>
> I'll try make a branch for this in the next week or so for you to review.

Thanks very much, I'll look throught it as soon as I find some time,
probably not next week (I'm travelling), but hopefully the week after
that, at the latest.

>> As to (b), I saw you moved the code to zope.app.testing. I have a
>> few ideas in that area which I'll contact you off-list about.
> Sure!

As we've discussed off-list, we now both feel that moving the
publisher-testbrowser to zope.app.testing is a good idea, since the only
applications that will want to use that testbrowser are those that use
zope.app.testing -- the more modern approach of testing publisher-based
applications is to use the code from zope.app.wsgi to create a WSGI
application and then use the WSGI-enabled testbrowser to talk to that.

Wolfgang



More information about the Zope-Dev mailing list