``zope.testbrowser`` README
===========================
.. image:: https://img.shields.io/pypi/v/zope.testbrowser.svg
:target: https://pypi.org/project/zope.testbrowser/
:alt: Latest Version
.. image:: https://img.shields.io/pypi/pyversions/zope.testbrowser.svg
:target: https://pypi.org/project/zope.testbrowser/
:alt: Supported Python versions
.. image:: https://github.com/zopefoundation/zope.testbrowser/actions/workflows/tests.yml/badge.svg
:target: https://github.com/zopefoundation/zope.testbrowser/actions/workflows/tests.yml
.. image:: https://readthedocs.org/projects/zopetestbrowser/badge/?version=latest
:target: http://zopetestbrowser.readthedocs.org/en/latest/
:alt: Documentation Status
``zope.testbrowser`` provides an easy-to-use programmable web browser
with special focus on testing. It is used in Zope, but it's not Zope
specific at all. For instance, it can be used to test or otherwise
interact with any web site.
Documentation is available at: https://zopetestbrowser.readthedocs.org
=======
CHANGES
=======
7.0 (2024-05-31)
----------------
- Add support for Python 3.12 and 3.13 as of 3.13b1.
- Drop support for Python 3.7.
6.0 (2023-03-27)
----------------
- Drop support for Python 2.7, 3.5, 3.6.
- Drop support for deprecated ``python setup.py test``.
- Add support for Python 3.11.
- Do not break in ``mechRepr`` when using ``<input type="date">``.
5.6.1 (2022-01-21)
------------------
- Ensure all objects have consistent resolution orders.
5.6.0 (2022-01-21)
------------------
- Add support for Python 3.9 and 3.10.
5.5.1 (2019-11-12)
------------------
- Stop sending a ``Referer`` header when ``browser.open`` or
``browser.post`` is called directly. See `issue 87
<https://github.com/zopefoundation/zope.testbrowser/issues/87>`_.
- Add error checking to the setters for ``ListControl.displayValue`` and
``CheckboxListControl.displayValue``: in line with the old
``mechanize``-based implementation, these will now raise
``ItemNotFoundError`` if any of the given values are not found, or
``ItemCountError`` on trying to set more than one value on a single-valued
control. See `issue 44
<https://github.com/zopefoundation/zope.testbrowser/issues/44>`_.
- Fix AttributeError in `add_file` when trying to add to a control which is
not a file upload.
5.5.0 (2019-11-11)
------------------
- Fix a bug where ``browser.goBack()`` did not invalidate caches, so
subsequent queries could use data from the wrong response. See `issue 83
<https://github.com/zopefoundation/zope.testbrowser/issues/83>`_.
- Support telling the browser not to follow redirects by setting
``Browser.follow_redirects`` to False. See `issue 79
<https://github.com/zopefoundation/zope.testbrowser/issues/79>`_.
5.4.0 (2019-11-01)
------------------
- Fix a bug where browser.reload() would not follow redirects or raise
exceptions for bad HTTP statuses. See `issue 75
<https://github.com/zopefoundation/zope.testbrowser/issues/75>`_.
- Add Python 3.8 support. See `issue 80
<https://github.com/zopefoundation/zope.testbrowser/issues/80>`_.
5.3.3 (2019-07-02)
------------------
- Fix a bug where clicking the selected radio button would unselect it. See
`issue 68 <https://github.com/zopefoundation/zope.testbrowser/issues/68>`_.
- Fix another incompatibility with BeautifulSoup4 >= 4.7 that could result
in a SyntaxError from browser.getLink(). See `issue 61
<https://github.com/zopefoundation/zope.testbrowser/issues/61>`_.
5.3.2 (2019-02-06)
------------------
- Fix an incompatibility with BeautifulSoup4 >= 4.7 that could result
in a SyntaxError from browser.getControl(). See `issue 61
<https://github.com/zopefoundation/zope.testbrowser/issues/61>`_.
- Fix a bug where you couldn't set a cookie expiration date when your locale
was not English. See `issue 65
<https://github.com/zopefoundation/zope.testbrowser/issues/65>`_.
- Fix narrative doctests that started failing on January 1st, 2019 due to a
hardcoded "future" date. See `issue 62
<https://github.com/zopefoundation/zope.testbrowser/issues/62>`_.
5.3.1 (2018-10-23)
------------------
- Fix a ``DeprecationWarning`` on Python 3. See `issue 51
<https://github.com/zopefoundation/zope.testbrowser/issues/51>`_.
5.3.0 (2018-10-10)
------------------
- Add support for Python 3.7.
- Drop support for Python 3.3 and 3.4.
- Drop support for pystone as Python 3.7 dropped pystone. So
``Browser.lastRequestPystones`` no longer exists. Rename
``.browser.PystoneTimer`` to ``.browser.Timer``.
- Fix ``mechRepr`` of CheckboxListControl to always return a native str.
(https://github.com/zopefoundation/zope.testbrowser/pull/46).
- Add ``mechRepr`` to input fields having the type ``email``.
(https://github.com/zopefoundation/zope.testbrowser/pull/47).
5.2.4 (2017-11-24)
------------------
- Fix form submit with GET method if the form action contains a query string
(https://github.com/zopefoundation/zope.testbrowser/pull/42).
- Restore ignoring hidden elements when searching by label
(https://github.com/zopefoundation/zope.testbrowser/pull/41).
5.2.3 (2017-10-18)
------------------
- Fix ``mechRepr`` on controls to always return a native str
(https://github.com/zopefoundation/zope.testbrowser/issues/38).
5.2.2 (2017-10-10)
------------------
- 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 (2017-09-01)
------------------
- 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 (2017-02-25)
----------------
- 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 (2017-01-31)
----------------
- Alias ``.browser.urllib_request.HTTPError`` to ``.browser.HTTPError`` to have
a better API.
5.0.0 (2016-09-30)
------------------
- 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 (2013-09-04)
------------------
- 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 (2011-05-25)
------------------
- Remove test dependency on zope.pagetemplate.
4.0.1 (2011-05-04)
------------------
- 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 (2011-03-14)
------------------
- 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 (2011-01-24)
-------------------
- Fixing brown bag release 3.11.0.
3.11.0 (2011-01-24)
-------------------
- Add ``wsgi_intercept`` support (came from ``zope.app.wsgi.testlayer``).
3.10.4 (2011-01-14)
-------------------
- Move the over-the-wire.txt doctest out of the TestBrowserLayer as it doesn't
need or use it.
- Fix test compatibility with zope.app.testing 3.8.1.
3.10.3 (2010-10-15)
-------------------
- Fixed backwards compatibility with ``zope.app.wsgi.testlayer``.
3.10.2 (2010-10-15)
-------------------
- Fixed Python 2.7 compatibility in Browser.handleErrors.
3.10.1 (2010-09-21)
-------------------
- Fixed a bug that caused the ``Browser`` to keep it's previous ``contents``
The places are:
- Link.click()
- SubmitControl.click()
- ImageControl.click()
- Form.submit()
- Also adjusted exception messages at the above places to match
pre version 3.4.1 messages.
3.10.0 (2010-09-14)
-------------------
- LP #98437: use ``mechanize``'s built-in ``submit()`` to submit forms,
allowing ``mechanize`` to set the "Referer:" (sic) header appropriately.
- Fixed tests to run with ``zope.app.testing`` 3.8 and above.
3.9.0 (2010-05-17)
------------------
- LP #568806: Update dependency ``mechanize >= 0.2.0``, which now includes
the ``ClientForm`` APIs. Remove use of ``urllib2`` APIs (incompatible
with ``mechanize 0.2.0``) in favor of ``mechanize`` equivalents.
Thanks to John J. Lee for the patch.
- Use stdlib ``doctest`` module, instead of ``zope.testing.doctest``.
- **Caution:** This version is no longer fully compatible with Python 2.4:
``handleErrors = False`` no longer works.
3.8.1 (2010-04-19)
------------------
- Pin dependency on ``mechanize`` to prevent use of the upcoming
0.2.0 release before we have time to adjust to its API changes.
- Fix LP #98396: testbrowser resolves relative URLs incorrectly.
3.8.0 (2010-03-05)
------------------
- Add ``follow`` convenience method which gets and follows a link.
3.7.0 (2009-12-17)
------------------
- Move ``zope.app.testing`` dependency into the scope of the
``PublisherConnection`` class. Zope2 specifies its own version of
``PublisherConnection`` which isn't dependent on ``zope.app.testing``.
- Fix LP #419119: return ``None`` when the browser has no contents instead
of raising an exception.
3.7.0a1 (2009-08-29)
--------------------
- Update dependency from ``zope.app.publisher`` to
``zope.browserpage``, ``zope.browserresource`` and ``zope.ptresource``.
- Remove dependencies on ``zope.app.principalannotation`` and
``zope.securitypolicy`` by using the simple ``PermissiveSecurityPolicy``.
- Replace the testing dependency on ``zope.app.zcmlfiles`` with explicit
dependencies of a minimal set of packages.
- Remove unneeded ``zope.app.authentication`` from ftesting.zcml.
- Update dependency from ``zope.app.securitypolicy`` to
``zope.securitypolicy``.
3.6.0a2 (2009-01-31)
--------------------
- Update dependency from ``zope.app.folder`` to ``zope.site.folder``.
- Remove unnecessary test dependency in ``zope.app.component``.
3.6.0a1 (2009-01-08)
--------------------
- Update author e-mail to ``zope-dev`` rather than ``zope3-dev``.
- No longer strip newlines in XML and HTML code contained in a
``<textarea>``; fix requires ClientForm >= 0.2.10 (LP #268139).
- Add ``cookies`` attribute to browser for easy manipulation of browser
cookies. See brief example in main documentation, plus new ``cookies.txt``
documentation.
3.5.1 (2008-10-10)
------------------
- Work around for a ``mechanize``/``urllib2`` bug on Python 2.6 missing
``timeout`` attribute on ``Request`` base class.
- Work around for a ``mechanize``/``urllib2`` bug in creating request objects
that won't handle fragment URLs correctly.
3.5.0 (2008-03-30)
------------------
- Add a ``zope.testbrowser.testing.Browser.post`` method that allows
tests to supply a body and a content type. This is handy for
testing Ajax requests with non-form input (e.g. JSON).
- Remove vendor import of ``mechanize``.
- Fix bug that caused HTTP exception tracebacks to differ between version 3.4.0
and 3.4.1.
- Work around a bug in Python ``Cookie.SimpleCookie`` when handling unicode
strings.
- Fix bug introduced in 3.4.1 that created incompatible tracebacks in doctests.
This necessitated adding a patched ``mechanize`` to the source tree; patches
have been sent to the ``mechanize`` project.
- Fix https://bugs.launchpad.net/bugs/149517 by adding ``zope.interface`` and
``zope.schema`` as real dependencies
- Fix ``browser.getLink`` documentation that was not updated since the last
API modification.
- Move tests for fixed bugs to a separate file.
- Remove non-functional and undocumented code intended to help test servers
using virtual hosting.
3.4.2 (2007-10-31)
------------------
- Resolve ``ZopeSecurityPolicy`` deprecation warning.
3.4.1 (2007-09-01)
------------------
* Update dependencies to ``mechanize 0.1.7b`` and ``ClientForm 0.2.7``.
* Add support for Python 2.5.
3.4.0 (2007-06-04)
------------------
* Add the ability to suppress raising exceptions on HTTP errors
(``raiseHttpErrors`` attribute).
* Make the tests more resilient to HTTP header formatting changes with
the REnormalizer.
3.4.0a1 (2007-04-22)
--------------------
Initial release as a separate project, corresponds to zope.testbrowser
from Zope 3.4.0a1
Raw data
{
"_id": null,
"home_page": "https://github.com/zopefoundation/zope.testbrowser",
"name": "zope.testbrowser",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "headless browser functional tests WSGI HTTP HTML form",
"author": "Zope Corporation and Contributors",
"author_email": "zope-dev@zope.dev",
"download_url": "https://files.pythonhosted.org/packages/46/5f/db2128c4dc3cc3077d2652ba2232685fb2f8c0ee6bd970b2dbf165ef7a54/zope.testbrowser-7.0.tar.gz",
"platform": null,
"description": "``zope.testbrowser`` README\n===========================\n\n.. image:: https://img.shields.io/pypi/v/zope.testbrowser.svg\n :target: https://pypi.org/project/zope.testbrowser/\n :alt: Latest Version\n\n.. image:: https://img.shields.io/pypi/pyversions/zope.testbrowser.svg\n :target: https://pypi.org/project/zope.testbrowser/\n :alt: Supported Python versions\n\n.. image:: https://github.com/zopefoundation/zope.testbrowser/actions/workflows/tests.yml/badge.svg\n :target: https://github.com/zopefoundation/zope.testbrowser/actions/workflows/tests.yml\n\n.. image:: https://readthedocs.org/projects/zopetestbrowser/badge/?version=latest\n :target: http://zopetestbrowser.readthedocs.org/en/latest/\n :alt: Documentation Status\n\n``zope.testbrowser`` provides an easy-to-use programmable web browser\nwith special focus on testing. It is used in Zope, but it's not Zope\nspecific at all. For instance, it can be used to test or otherwise\ninteract with any web site.\n\nDocumentation is available at: https://zopetestbrowser.readthedocs.org\n\n\n=======\nCHANGES\n=======\n\n7.0 (2024-05-31)\n----------------\n\n- Add support for Python 3.12 and 3.13 as of 3.13b1.\n\n- Drop support for Python 3.7.\n\n\n6.0 (2023-03-27)\n----------------\n\n- Drop support for Python 2.7, 3.5, 3.6.\n\n- Drop support for deprecated ``python setup.py test``.\n\n- Add support for Python 3.11.\n\n- Do not break in ``mechRepr`` when using ``<input type=\"date\">``.\n\n\n5.6.1 (2022-01-21)\n------------------\n\n- Ensure all objects have consistent resolution orders.\n\n\n5.6.0 (2022-01-21)\n------------------\n\n- Add support for Python 3.9 and 3.10.\n\n\n5.5.1 (2019-11-12)\n------------------\n\n- Stop sending a ``Referer`` header when ``browser.open`` or\n ``browser.post`` is called directly. See `issue 87\n <https://github.com/zopefoundation/zope.testbrowser/issues/87>`_.\n\n- Add error checking to the setters for ``ListControl.displayValue`` and\n ``CheckboxListControl.displayValue``: in line with the old\n ``mechanize``-based implementation, these will now raise\n ``ItemNotFoundError`` if any of the given values are not found, or\n ``ItemCountError`` on trying to set more than one value on a single-valued\n control. See `issue 44\n <https://github.com/zopefoundation/zope.testbrowser/issues/44>`_.\n\n- Fix AttributeError in `add_file` when trying to add to a control which is\n not a file upload.\n\n5.5.0 (2019-11-11)\n------------------\n\n- Fix a bug where ``browser.goBack()`` did not invalidate caches, so\n subsequent queries could use data from the wrong response. See `issue 83\n <https://github.com/zopefoundation/zope.testbrowser/issues/83>`_.\n\n- Support telling the browser not to follow redirects by setting\n ``Browser.follow_redirects`` to False. See `issue 79\n <https://github.com/zopefoundation/zope.testbrowser/issues/79>`_.\n\n\n5.4.0 (2019-11-01)\n------------------\n\n- Fix a bug where browser.reload() would not follow redirects or raise\n exceptions for bad HTTP statuses. See `issue 75\n <https://github.com/zopefoundation/zope.testbrowser/issues/75>`_.\n\n- Add Python 3.8 support. See `issue 80\n <https://github.com/zopefoundation/zope.testbrowser/issues/80>`_.\n\n\n5.3.3 (2019-07-02)\n------------------\n\n- Fix a bug where clicking the selected radio button would unselect it. See\n `issue 68 <https://github.com/zopefoundation/zope.testbrowser/issues/68>`_.\n\n- Fix another incompatibility with BeautifulSoup4 >= 4.7 that could result\n in a SyntaxError from browser.getLink(). See `issue 61\n <https://github.com/zopefoundation/zope.testbrowser/issues/61>`_.\n\n\n5.3.2 (2019-02-06)\n------------------\n\n- Fix an incompatibility with BeautifulSoup4 >= 4.7 that could result\n in a SyntaxError from browser.getControl(). See `issue 61\n <https://github.com/zopefoundation/zope.testbrowser/issues/61>`_.\n\n- Fix a bug where you couldn't set a cookie expiration date when your locale\n was not English. See `issue 65\n <https://github.com/zopefoundation/zope.testbrowser/issues/65>`_.\n\n- Fix narrative doctests that started failing on January 1st, 2019 due to a\n hardcoded \"future\" date. See `issue 62\n <https://github.com/zopefoundation/zope.testbrowser/issues/62>`_.\n\n\n5.3.1 (2018-10-23)\n------------------\n\n- Fix a ``DeprecationWarning`` on Python 3. See `issue 51\n <https://github.com/zopefoundation/zope.testbrowser/issues/51>`_.\n\n\n5.3.0 (2018-10-10)\n------------------\n\n- Add support for Python 3.7.\n\n- Drop support for Python 3.3 and 3.4.\n\n- Drop support for pystone as Python 3.7 dropped pystone. So\n ``Browser.lastRequestPystones`` no longer exists. Rename\n ``.browser.PystoneTimer`` to ``.browser.Timer``.\n\n- Fix ``mechRepr`` of CheckboxListControl to always return a native str.\n (https://github.com/zopefoundation/zope.testbrowser/pull/46).\n\n- Add ``mechRepr`` to input fields having the type ``email``.\n (https://github.com/zopefoundation/zope.testbrowser/pull/47).\n\n\n5.2.4 (2017-11-24)\n------------------\n\n- Fix form submit with GET method if the form action contains a query string\n (https://github.com/zopefoundation/zope.testbrowser/pull/42).\n\n- Restore ignoring hidden elements when searching by label\n (https://github.com/zopefoundation/zope.testbrowser/pull/41).\n\n\n5.2.3 (2017-10-18)\n------------------\n\n- Fix ``mechRepr`` on controls to always return a native str\n (https://github.com/zopefoundation/zope.testbrowser/issues/38).\n\n\n5.2.2 (2017-10-10)\n------------------\n\n- Restore raising of AttributeError when trying to set value of a\n read only control.\n\n- Fix selecting radio and select control options by index\n (https://github.com/zopefoundation/zope.testbrowser/issues/31).\n\n\n5.2.1 (2017-09-01)\n------------------\n\n- Exclude version 2.0.27 of `WebTest` from allowed versions as it breaks some\n tests.\n\n- Adapt tests to version 2.0.28 of `WebTest` but keeping compatibility to older\n versions.\n\n\n5.2 (2017-02-25)\n----------------\n\n- Fixed ``toStr`` to handle lists, for example a list of class names.\n [maurits]\n\n- Fixed browser to only follow redirects for HTTP statuses\n 301, 302, 303, and 307; not other 30x statuses such as 304.\n\n- Fix passing a real file to ``add_file``.\n\n- Add ``controls`` property to Form class to list all form controls.\n\n- Restore the ability to use parts of the actually displayed select box titles.\n\n- Allow to set a string value instead of a list on ``Browser.displayValue``.\n\n- Fix setting empty values on a select control.\n\n- Support Python 3.6, PyPy2.7 an PyPy3.3.\n\n\n5.1 (2017-01-31)\n----------------\n\n- Alias ``.browser.urllib_request.HTTPError`` to ``.browser.HTTPError`` to have\n a better API.\n\n\n5.0.0 (2016-09-30)\n------------------\n\n- Converted most doctests to Sphinx documentation, and published to\n https://zopetestbrowser.readthedocs.io/ .\n\n- Internal implementation now uses WebTest instead of ``mechanize``.\n The ``mechanize`` dependency is completely dropped.\n **This is a backwards-incompatible change.**\n\n- Remove APIs:\n\n - ``zope.testbrowser.testing.Browser`` (this is a big one).\n\n Instead of using ``zope.testbrowser.testing.Browser()`` and relying on\n it to magically pick up the ``zope.app.testing.functional`` singleton\n application, you now have to define a test layer inheriting from\n ``zope.testbrowser.wsgi.Layer``, overrride the ``make_wsgi_app`` method\n to create a WSGI application, and then use\n ``zope.testbrowser.wsgi.Browser()`` in your tests.\n\n (Or you can set up a WSGI application yourself in whatever way you like\n and pass it explicitly to\n ``zope.testbrowser.browser.Browser(wsgi_app=my_app)``.)\n\n Example: if your test file looked like this ::\n\n # my/package/tests.py\n from zope.app.testing.functional import defineLayer\n from zope.app.testing.functional import FunctionalDocFileSuite\n defineLayer('MyFtestLayer', 'ftesting.zcml', allow_teardown=True)\n\n def test_suite():\n suite = FunctionalDocFileSuite('test.txt', ...)\n suite.layer = MyFtestLayer\n return suite\n\n now you'll have to use ::\n\n # my/package/tests.py\n from unittest import TestSuite\n import doctest\n import zope.app.wsgi.testlayer\n import zope.testbrowser.wsgi\n\n class Layer(zope.testbrowser.wsgi.TestBrowserLayer,\n zope.app.wsgi.testlayer.BrowserLayer):\n \"\"\"Layer to prepare zope.testbrowser using the WSGI app.\"\"\"\n\n layer = Layer(my.package, 'ftesting.zcml', allowTearDown=True)\n\n def test_suite():\n suite = doctest.DocFileSuite('test.txt', ...)\n suite.layer = layer\n return suite\n\n and then change all your tests from ::\n\n >>> from zope.testbrowser.testing import Browser\n\n to ::\n\n >>> from zope.testbrowser.wsgi import Browser\n\n Maybe the blog post `Getting rid of zope.app.testing`_ could help you adapting to this new version, too.\n\n- Remove modules:\n\n - ``zope.testbrowser.connection``\n\n- Remove internal classes you were not supposed to use anyway:\n\n - ``zope.testbrowser.testing.PublisherResponse``\n - ``zope.testbrowser.testing.PublisherConnection``\n - ``zope.testbrowser.testing.PublisherHTTPHandler``\n - ``zope.testbrowser.testing.PublisherMechanizeBrowser``\n - ``zope.testbrowser.wsgi.WSGIConnection``\n - ``zope.testbrowser.wsgi.WSGIHTTPHandler``\n - ``zope.testbrowser.wsgi.WSGIMechanizeBrowser``\n\n- Remove internal attributes you were not supposed to use anyway (this\n list is not necessarily complete):\n\n - ``Browser._mech_browser``\n\n- Remove setuptools extras:\n\n - ``zope.testbrowser[zope-functional-testing]``\n\n- Changed behavior:\n\n - The testbrowser no longer follows HTML redirects aka\n ``<meta http-equiv=\"refresh\" ... />``. This was a `mechanize` feature which\n does not seem to be provided by `WebTest`.\n\n- Add support for Python 3.3, 3.4 and 3.5.\n\n- Drop support for Python 2.5 and 2.6.\n\n- Drop the ``WebTest <= 1.3.4`` pin. We require ``WebTest >= 2.0.8`` now.\n\n- Remove dependency on deprecated ``zope.app.testing``.\n\n- Bugfix: ``browser.getLink()`` could fail if your HTML contained ``<a>``\n elements with no href attribute\n (https://github.com/zopefoundation/zope.testbrowser/pull/3).\n\n\n.. _`Getting rid of zope.app.testing` : https://icemac15.wordpress.com/2010/07/10/appswordpressicemac20100710get-rid-of-zope-app-testing-dependency/\n\n\n4.0.3 (2013-09-04)\n------------------\n\n- pinning version 'WebTest <= 1.3.4', because of some incompatibility and\n test failures\n\n- Make zope.testbrowser installable via pip\n (https://github.com/zopefoundation/zope.testbrowser/issues/6).\n\n- When ``Browser.handleErrors`` is False, also add ``x-wsgiorg.throw_errors``\n to the environment. http://wsgi.org/wsgi/Specifications/throw_errors\n\n- Prevent WebTest from always sending ``paste.throw_errors=True`` in the\n environment by setting it to ``None`` when ``Browser.handleErrors`` is\n ``True``. This makes it easier to test error pages.\n\n- Make Browser.submit() handle ``raiseHttpErrors``\n (https://github.com/zopefoundation/zope.testbrowser/pull/4).\n\n- More friendly error messages from getControl() et al:\n\n - when you specify an index that is out of bounds, show the available\n choices\n\n - when you fail to find anything, show all the available items\n\n\n4.0.2 (2011-05-25)\n------------------\n\n- Remove test dependency on zope.pagetemplate.\n\n\n4.0.1 (2011-05-04)\n------------------\n\n- Add a hint in documentation how to use ``zope.testbrowser.wsgi.Browser``\n to test a Zope 2/Zope 3/Bluebream WSGI application.\n\n4.0.0 (2011-03-14)\n------------------\n\n- LP #721252: AmbiguityError now shows all matching controls.\n\n- Integrate with WebTest. ``zope.testbrowser.wsgi.Browser`` is a\n ``Browser`` implementation that uses ``webtest.TestApp`` to drive a WSGI\n application. This this replaces the wsgi_intercept support added in 3.11.\n\n- Re-write the test application as a pure WSGI application using WebOb. Run the\n existing tests using the WebTest based Browser\n\n- Move zope.app.testing based Browser into ``zope.app.testing`` (leaving\n backwards compatibility imports in-place). Released in ``zope.app.testing``\n 3.9.0.\n\n\n3.11.1 (2011-01-24)\n-------------------\n\n- Fixing brown bag release 3.11.0.\n\n\n3.11.0 (2011-01-24)\n-------------------\n\n- Add ``wsgi_intercept`` support (came from ``zope.app.wsgi.testlayer``).\n\n\n3.10.4 (2011-01-14)\n-------------------\n\n- Move the over-the-wire.txt doctest out of the TestBrowserLayer as it doesn't\n need or use it.\n\n- Fix test compatibility with zope.app.testing 3.8.1.\n\n3.10.3 (2010-10-15)\n-------------------\n\n- Fixed backwards compatibility with ``zope.app.wsgi.testlayer``.\n\n\n3.10.2 (2010-10-15)\n-------------------\n\n- Fixed Python 2.7 compatibility in Browser.handleErrors.\n\n\n3.10.1 (2010-09-21)\n-------------------\n\n- Fixed a bug that caused the ``Browser`` to keep it's previous ``contents``\n The places are:\n - Link.click()\n - SubmitControl.click()\n - ImageControl.click()\n - Form.submit()\n\n- Also adjusted exception messages at the above places to match\n pre version 3.4.1 messages.\n\n\n3.10.0 (2010-09-14)\n-------------------\n\n- LP #98437: use ``mechanize``'s built-in ``submit()`` to submit forms,\n allowing ``mechanize`` to set the \"Referer:\" (sic) header appropriately.\n\n- Fixed tests to run with ``zope.app.testing`` 3.8 and above.\n\n\n3.9.0 (2010-05-17)\n------------------\n\n- LP #568806: Update dependency ``mechanize >= 0.2.0``, which now includes\n the ``ClientForm`` APIs. Remove use of ``urllib2`` APIs (incompatible\n with ``mechanize 0.2.0``) in favor of ``mechanize`` equivalents.\n Thanks to John J. Lee for the patch.\n\n- Use stdlib ``doctest`` module, instead of ``zope.testing.doctest``.\n\n- **Caution:** This version is no longer fully compatible with Python 2.4:\n ``handleErrors = False`` no longer works.\n\n\n3.8.1 (2010-04-19)\n------------------\n\n- Pin dependency on ``mechanize`` to prevent use of the upcoming\n 0.2.0 release before we have time to adjust to its API changes.\n\n- Fix LP #98396: testbrowser resolves relative URLs incorrectly.\n\n\n3.8.0 (2010-03-05)\n------------------\n\n- Add ``follow`` convenience method which gets and follows a link.\n\n\n3.7.0 (2009-12-17)\n------------------\n\n- Move ``zope.app.testing`` dependency into the scope of the\n ``PublisherConnection`` class. Zope2 specifies its own version of\n ``PublisherConnection`` which isn't dependent on ``zope.app.testing``.\n\n- Fix LP #419119: return ``None`` when the browser has no contents instead\n of raising an exception.\n\n\n3.7.0a1 (2009-08-29)\n--------------------\n\n- Update dependency from ``zope.app.publisher`` to\n ``zope.browserpage``, ``zope.browserresource`` and ``zope.ptresource``.\n\n- Remove dependencies on ``zope.app.principalannotation`` and\n ``zope.securitypolicy`` by using the simple ``PermissiveSecurityPolicy``.\n\n- Replace the testing dependency on ``zope.app.zcmlfiles`` with explicit\n dependencies of a minimal set of packages.\n\n- Remove unneeded ``zope.app.authentication`` from ftesting.zcml.\n\n- Update dependency from ``zope.app.securitypolicy`` to\n ``zope.securitypolicy``.\n\n\n3.6.0a2 (2009-01-31)\n--------------------\n\n- Update dependency from ``zope.app.folder`` to ``zope.site.folder``.\n\n- Remove unnecessary test dependency in ``zope.app.component``.\n\n\n3.6.0a1 (2009-01-08)\n--------------------\n\n- Update author e-mail to ``zope-dev`` rather than ``zope3-dev``.\n\n- No longer strip newlines in XML and HTML code contained in a\n ``<textarea>``; fix requires ClientForm >= 0.2.10 (LP #268139).\n\n- Add ``cookies`` attribute to browser for easy manipulation of browser\n cookies. See brief example in main documentation, plus new ``cookies.txt``\n documentation.\n\n\n3.5.1 (2008-10-10)\n------------------\n\n- Work around for a ``mechanize``/``urllib2`` bug on Python 2.6 missing\n ``timeout`` attribute on ``Request`` base class.\n\n- Work around for a ``mechanize``/``urllib2`` bug in creating request objects\n that won't handle fragment URLs correctly.\n\n\n3.5.0 (2008-03-30)\n------------------\n\n- Add a ``zope.testbrowser.testing.Browser.post`` method that allows\n tests to supply a body and a content type. This is handy for\n testing Ajax requests with non-form input (e.g. JSON).\n\n- Remove vendor import of ``mechanize``.\n\n- Fix bug that caused HTTP exception tracebacks to differ between version 3.4.0\n and 3.4.1.\n\n- Work around a bug in Python ``Cookie.SimpleCookie`` when handling unicode\n strings.\n\n- Fix bug introduced in 3.4.1 that created incompatible tracebacks in doctests.\n This necessitated adding a patched ``mechanize`` to the source tree; patches\n have been sent to the ``mechanize`` project.\n\n- Fix https://bugs.launchpad.net/bugs/149517 by adding ``zope.interface`` and\n ``zope.schema`` as real dependencies\n\n- Fix ``browser.getLink`` documentation that was not updated since the last\n API modification.\n\n- Move tests for fixed bugs to a separate file.\n\n- Remove non-functional and undocumented code intended to help test servers\n using virtual hosting.\n\n\n3.4.2 (2007-10-31)\n------------------\n\n- Resolve ``ZopeSecurityPolicy`` deprecation warning.\n\n\n3.4.1 (2007-09-01)\n------------------\n\n* Update dependencies to ``mechanize 0.1.7b`` and ``ClientForm 0.2.7``.\n\n* Add support for Python 2.5.\n\n\n3.4.0 (2007-06-04)\n------------------\n\n* Add the ability to suppress raising exceptions on HTTP errors\n (``raiseHttpErrors`` attribute).\n\n* Make the tests more resilient to HTTP header formatting changes with\n the REnormalizer.\n\n\n3.4.0a1 (2007-04-22)\n--------------------\n\nInitial release as a separate project, corresponds to zope.testbrowser\nfrom Zope 3.4.0a1\n",
"bugtrack_url": null,
"license": "ZPL 2.1",
"summary": "Programmable browser for functional black-box tests",
"version": "7.0",
"project_urls": {
"Documentation": "https://zopetestbrowser.readthedocs.io/",
"Homepage": "https://github.com/zopefoundation/zope.testbrowser"
},
"split_keywords": [
"headless",
"browser",
"functional",
"tests",
"wsgi",
"http",
"html",
"form"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "84777e1cd9022a41bb3294b735f460b8a7ec59c3d0ba0e8b1f84d8a3674615e0",
"md5": "e9c9aa452b05266f7631c40752b8e4fe",
"sha256": "75fa5f63f69fe4ebd6e6a7cebf2dc7da61a4c2a248f69b0b171d218af51a860e"
},
"downloads": -1,
"filename": "zope.testbrowser-7.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e9c9aa452b05266f7631c40752b8e4fe",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 63464,
"upload_time": "2024-05-31T08:46:00",
"upload_time_iso_8601": "2024-05-31T08:46:00.316999Z",
"url": "https://files.pythonhosted.org/packages/84/77/7e1cd9022a41bb3294b735f460b8a7ec59c3d0ba0e8b1f84d8a3674615e0/zope.testbrowser-7.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "465fdb2128c4dc3cc3077d2652ba2232685fb2f8c0ee6bd970b2dbf165ef7a54",
"md5": "4804b3c956294d11d3c6f9ab0711ab1a",
"sha256": "5936d2a0d77d8781d001358fd0b11461285b02dc6e3b324b84c1ed9326b1ff3f"
},
"downloads": -1,
"filename": "zope.testbrowser-7.0.tar.gz",
"has_sig": false,
"md5_digest": "4804b3c956294d11d3c6f9ab0711ab1a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 85418,
"upload_time": "2024-05-31T08:46:03",
"upload_time_iso_8601": "2024-05-31T08:46:03.494706Z",
"url": "https://files.pythonhosted.org/packages/46/5f/db2128c4dc3cc3077d2652ba2232685fb2f8c0ee6bd970b2dbf165ef7a54/zope.testbrowser-7.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-31 08:46:03",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "zopefoundation",
"github_project": "zope.testbrowser",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "zope.testbrowser"
}