[Zope-dev] Switching zope.testbrowser to webtest instead of mechanize
Brian Sutherland
brian at vanguardistas.net
Tue Mar 5 16:45:04 UTC 2013
On Tue, Mar 05, 2013 at 05:56:54PM +0200, Andrey Lebedev wrote:
> On 03/05/2013 05:10 PM, Brian Sutherland wrote:
> >>So far, it seems webtest has all the features needed to do the
> >>>switch. I started a branch at github ([2]) to track work in
> >>>progress. The goal is to make most (say 80%) of existing tests to
> >>>work without modifications under new implementation.
>
> >Looking at the branch, it seems that this is basically going to be a
> >re-write of the existing code.
>
> Yes, it is a re-write, but not re-write from scratch. I use existing
> code as much as possible.
>
> >You're planning to keep the mechanize backend available?
>
> Initially we didn't plan to keep mechanize. I think it would add an
> unjustified burden of choice to users (which backend to pick, if
> they work the same way?) and mechanize backend will/may not work in
> python3 anyway.
>
> The question of how compatible the webtest-based implementation will
> be, is still an open one though. However, we have a big real-world
> project to test compatibility against.
You're right, the big question is how compatible the WebTest version
will be. I don't think anyone will object to a drop-in replacement.
Having to modify 20% of existing tests sounds like a lot. I guess we'll
have to see how compatible the new browser will be.
I'm willing to pitch in by testing it against my own application, please
let me know when/if you want me to do that.
> >Might I suggest zope.testbrowser.webtest for the WebTest backed
> >testbrowser rather than zope.testbrowser.browser2?
>
> I admit there is a bit of mess right now in the branch as I need to
> preserve existing code to copy when applicable. My plan is to rename
> z.t.browser2 to z.t.browser eventually, so it is not a final name.
Ok!
> >Could you also keep the tests for the mechanize testbrowser intact?
> >They could be skipped if mechanize is not importable and mechanize
> >downgraded to an optional dependency.
>
> Again, if the compatibility of new implementation is proven to be
> "good enough", I see no reason to keep mechanize around. I might
> miss some important reasons, though.
One thing which I'm not sure you can do with a webtest backend is using
it as a real browser. i.e. you'll probably not get over_the_wire.txt to
pass. However, I don't know of anyone who actually uses that
functionality.
Hmm, though I guess you can have a WSGI application that fires off real
HTTP requests...
--
Brian Sutherland
More information about the Zope-Dev
mailing list