Zope.testbrowser

Latest version: v7.0

Safety actively analyzes 685670 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 4 of 8

5.0.0

------------------

- Converted most doctests to Sphinx documentation, and published to
https://zopetestbrowser.readthedocs.io/ .

- Internal implementation now uses WebTest instead of ``mechanize``.
The ``mechanize`` dependency is completely dropped.
**This is a backwards-incompatible change.**

- Remove APIs:

- ``zope.testbrowser.testing.Browser`` (this is a big one).

Instead of using ``zope.testbrowser.testing.Browser()`` and relying on
it to magically pick up the ``zope.app.testing.functional`` singleton
application, you now have to define a test layer inheriting from
``zope.testbrowser.wsgi.Layer``, overrride the ``make_wsgi_app`` method
to create a WSGI application, and then use
``zope.testbrowser.wsgi.Browser()`` in your tests.

(Or you can set up a WSGI application yourself in whatever way you like
and pass it explicitly to
``zope.testbrowser.browser.Browser(wsgi_app=my_app)``.)

Example: if your test file looked like this ::

my/package/tests.py
from zope.app.testing.functional import defineLayer
from zope.app.testing.functional import FunctionalDocFileSuite
defineLayer('MyFtestLayer', 'ftesting.zcml', allow_teardown=True)

def test_suite():
suite = FunctionalDocFileSuite('test.txt', ...)
suite.layer = MyFtestLayer
return suite

now you'll have to use ::

my/package/tests.py
from unittest import TestSuite
import doctest
import zope.app.wsgi.testlayer
import zope.testbrowser.wsgi

class Layer(zope.testbrowser.wsgi.TestBrowserLayer,
zope.app.wsgi.testlayer.BrowserLayer):
"""Layer to prepare zope.testbrowser using the WSGI app."""

layer = Layer(my.package, 'ftesting.zcml', allowTearDown=True)

def test_suite():
suite = doctest.DocFileSuite('test.txt', ...)
suite.layer = layer
return suite

and then change all your tests from ::

>>> from zope.testbrowser.testing import Browser

to ::

>>> from zope.testbrowser.wsgi import Browser

Maybe the blog post `Getting rid of zope.app.testing`_ could help you adapting to this new version, too.

- Remove modules:

- ``zope.testbrowser.connection``

- Remove internal classes you were not supposed to use anyway:

- ``zope.testbrowser.testing.PublisherResponse``
- ``zope.testbrowser.testing.PublisherConnection``
- ``zope.testbrowser.testing.PublisherHTTPHandler``
- ``zope.testbrowser.testing.PublisherMechanizeBrowser``
- ``zope.testbrowser.wsgi.WSGIConnection``
- ``zope.testbrowser.wsgi.WSGIHTTPHandler``
- ``zope.testbrowser.wsgi.WSGIMechanizeBrowser``

- Remove internal attributes you were not supposed to use anyway (this
list is not necessarily complete):

- ``Browser._mech_browser``

- Remove setuptools extras:

- ``zope.testbrowser[zope-functional-testing]``

- Changed behavior:

- The testbrowser no longer follows HTML redirects aka
``<meta http-equiv="refresh" ... />``. This was a `mechanize` feature which
does not seem to be provided by `WebTest`.

- Add support for Python 3.3, 3.4 and 3.5.

- Drop support for Python 2.5 and 2.6.

- Drop the ``WebTest <= 1.3.4`` pin. We require ``WebTest >= 2.0.8`` now.

- Remove dependency on deprecated ``zope.app.testing``.

- Bugfix: ``browser.getLink()`` could fail if your HTML contained ``<a>``
elements with no href attribute
(https://github.com/zopefoundation/zope.testbrowser/pull/3).


.. _`Getting rid of zope.app.testing` : https://icemac15.wordpress.com/2010/07/10/appswordpressicemac20100710get-rid-of-zope-app-testing-dependency/

4.0.3

------------------

- pinning version 'WebTest <= 1.3.4', because of some incompatibility and
test failures

- Make zope.testbrowser installable via pip
(https://github.com/zopefoundation/zope.testbrowser/issues/6).

- When ``Browser.handleErrors`` is False, also add ``x-wsgiorg.throw_errors``
to the environment. http://wsgi.org/wsgi/Specifications/throw_errors

- Prevent WebTest from always sending ``paste.throw_errors=True`` in the
environment by setting it to ``None`` when ``Browser.handleErrors`` is
``True``. This makes it easier to test error pages.

- Make Browser.submit() handle ``raiseHttpErrors``
(https://github.com/zopefoundation/zope.testbrowser/pull/4).

- More friendly error messages from getControl() et al:

- when you specify an index that is out of bounds, show the available
choices

- when you fail to find anything, show all the available items

4.0.2

------------------

- Remove test dependency on zope.pagetemplate.

4.0.1

------------------

- Add a hint in documentation how to use ``zope.testbrowser.wsgi.Browser``
to test a Zope 2/Zope 3/Bluebream WSGI application.

4.0.0

------------------

- LP 721252: AmbiguityError now shows all matching controls.

- Integrate with WebTest. ``zope.testbrowser.wsgi.Browser`` is a
``Browser`` implementation that uses ``webtest.TestApp`` to drive a WSGI
application. This this replaces the wsgi_intercept support added in 3.11.

- Re-write the test application as a pure WSGI application using WebOb. Run the
existing tests using the WebTest based Browser

- Move zope.app.testing based Browser into ``zope.app.testing`` (leaving
backwards compatibility imports in-place). Released in ``zope.app.testing``
3.9.0.

3.11.1

-------------------

- Fixing brown bag release 3.11.0.

Page 4 of 8

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.