Zope.testbrowser

Latest version: v6.0

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

Scan your dependencies

Page 3 of 7

5.2.3

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

- Fix ``mechRepr`` on controls to always return a native str
(https://github.com/zopefoundation/zope.testbrowser/issues/38).

5.2.2

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

- Restore raising of AttributeError when trying to set value of a
read only control.

- Fix selecting radio and select control options by index
(https://github.com/zopefoundation/zope.testbrowser/issues/31).

5.2.1

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

- Exclude version 2.0.27 of `WebTest` from allowed versions as it breaks some
tests.

- Adapt tests to version 2.0.28 of `WebTest` but keeping compatibility to older
versions.

5.2

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

- Fixed ``toStr`` to handle lists, for example a list of class names.
[maurits]

- Fixed browser to only follow redirects for HTTP statuses
301, 302, 303, and 307; not other 30x statuses such as 304.

- Fix passing a real file to ``add_file``.

- Add ``controls`` property to Form class to list all form controls.

- Restore the ability to use parts of the actually displayed select box titles.

- Allow to set a string value instead of a list on ``Browser.displayValue``.

- Fix setting empty values on a select control.

- Support Python 3.6, PyPy2.7 an PyPy3.3.

5.1

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

- Alias ``.browser.urllib_request.HTTPError`` to ``.browser.HTTPError`` to have
a better API.

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/

Page 3 of 7

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.