[Zope-dev] zope.testbrowser and WebTest

Brian Sutherland brian at vanguardistas.net
Thu Dec 16 02:38:26 EST 2010


On Thu, Dec 16, 2010 at 12:06:36AM +0100, Hanno Schlichting wrote:
> On Wed, Dec 15, 2010 at 2:06 PM, Brian Sutherland
> <brian at vanguardistas.net> wrote:
> > I've managed to get the existing tests to run against this browser with
> > two new testing dependencies:
> >    WebTest
> >    zope.app.wsgi
> 
> zope.app.wsgi shouldn't be a dependency of zope.testbrowser. It's ok
> if it's pulled in via a specific extra_requires like a [webtest]
> extra, though. Zope2 depends on zope.testbrowser and has no dependency
> on any zope.app packages - this must continue to be the case. Required
> test dependencies count towards real dependencies here.

I understand your point, but the situation was already pretty nasty as 
zope.testbrowser already depended on:

    zope.app.appsetup
    zope.app.publication
    zope.app.testing >= 3.8

I agree that any extra dependency is not welcome, but this feature opens
up a path to radically reducing the dependencies of zope.testbrowser.
See below.

> The real fix would probably be to move the reusable code out of
> zope.app.wsgi into a zope.wsgi package, but that might be more than
> you are willing to do now. I do believe some of the Grok people would
> be interested in this as well.

There is also another route open now with the addition of the webtest
feature. We could invert the zope.testbrowser -> zope.app.testing
dependency.

This is a major re-factoring, but will leave the zope.testbrowser
dependencies looking like this:

    install_requires = [
        'mechanize>=0.2.0',
        'setuptools',
        'zope.interface',
        'zope.schema',
        'pytz',
        ],
    extras_require = {
        'test': [
            'WebOb',
            'WebTest',
                ]

Basically this would require:

    * Re-writing the zope.testbrowser.ftests test application as a pure
      WSGI app (using WebOb)
    * Test only against zope.testbrowser.wsgi and refactor tests to not
      use features from zope.app.testing.functional
    * Move zope.testbrowser.testing into zope.testbrowser.wsgi and
      zope.app.testing.testbrowser
    * Leave backwards compatibility imports in place in
      zope.testbrowser.testing

I'd be willing to have a look at this if Benji were OK in principle on
this and someone was willing to review it.

-- 
Brian Sutherland


More information about the Zope-Dev mailing list