- Add support for Python 3.12 and 3.13 as of 3.13b1.
- Drop support for Python 3.7.
- 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">
.
- Ensure all objects have consistent resolution orders.
- Add support for Python 3.9 and 3.10.
- Stop sending a
Referer
header whenbrowser.open
orbrowser.post
is called directly. See issue 87. - Add error checking to the setters for
ListControl.displayValue
andCheckboxListControl.displayValue
: in line with the oldmechanize
-based implementation, these will now raiseItemNotFoundError
if any of the given values are not found, orItemCountError
on trying to set more than one value on a single-valued control. See issue 44. - Fix AttributeError in add_file when trying to add to a control which is not a file upload.
- Fix a bug where
browser.goBack()
did not invalidate caches, so subsequent queries could use data from the wrong response. See issue 83. - Support telling the browser not to follow redirects by setting
Browser.follow_redirects
to False. See issue 79.
- Fix a bug where browser.reload() would not follow redirects or raise exceptions for bad HTTP statuses. See issue 75.
- Add Python 3.8 support. See issue 80.
- Fix a bug where clicking the selected radio button would unselect it. See issue 68.
- Fix another incompatibility with BeautifulSoup4 >= 4.7 that could result in a SyntaxError from browser.getLink(). See issue 61.
- Fix an incompatibility with BeautifulSoup4 >= 4.7 that could result in a SyntaxError from browser.getControl(). See issue 61.
- Fix a bug where you couldn't set a cookie expiration date when your locale was not English. See issue 65.
- Fix narrative doctests that started failing on January 1st, 2019 due to a hardcoded "future" date. See issue 62.
- Fix a
DeprecationWarning
on Python 3. See issue 51.
- 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. (#46). - Add
mechRepr
to input fields having the typeemail
. (#47).
- Fix form submit with GET method if the form action contains a query string (#42).
- Restore ignoring hidden elements when searching by label (#41).
- Fix
mechRepr
on controls to always return a native str (#38).
- Restore raising of AttributeError when trying to set value of a read only control.
- Fix selecting radio and select control options by index (#31).
- 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.
- 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.
- Alias
.browser.urllib_request.HTTPError
to.browser.HTTPError
to have a better API.
Converted most doctests to Sphinx documentation, and published to https://zopetestbrowser.readthedocs.io/ .
Internal implementation now uses WebTest instead of
mechanize
. Themechanize
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 thezope.app.testing.functional
singleton application, you now have to define a test layer inheriting fromzope.testbrowser.wsgi.Layer
, overrride themake_wsgi_app
method to create a WSGI application, and then usezope.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.
- The testbrowser no longer follows HTML redirects aka
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 requireWebTest >= 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 (#3).
- pinning version 'WebTest <= 1.3.4', because of some incompatibility and test failures
- Make zope.testbrowser installable via pip (#6).
- When
Browser.handleErrors
is False, also addx-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 toNone
whenBrowser.handleErrors
isTrue
. This makes it easier to test error pages. - Make Browser.submit() handle
raiseHttpErrors
(#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
- Remove test dependency on zope.pagetemplate.
- Add a hint in documentation how to use
zope.testbrowser.wsgi.Browser
to test a Zope 2/Zope 3/Bluebream WSGI application.
- LP #721252: AmbiguityError now shows all matching controls.
- Integrate with WebTest.
zope.testbrowser.wsgi.Browser
is aBrowser
implementation that useswebtest.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 inzope.app.testing
3.9.0.
- Fixing brown bag release 3.11.0.
- Add
wsgi_intercept
support (came fromzope.app.wsgi.testlayer
).
- 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.
- Fixed backwards compatibility with
zope.app.wsgi.testlayer
.
- Fixed Python 2.7 compatibility in Browser.handleErrors.
- Fixed a bug that caused the
Browser
to keep it's previouscontents
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.
- LP #98437: use
mechanize
's built-insubmit()
to submit forms, allowingmechanize
to set the "Referer:" (sic) header appropriately. - Fixed tests to run with
zope.app.testing
3.8 and above.
- LP #568806: Update dependency
mechanize >= 0.2.0
, which now includes theClientForm
APIs. Remove use ofurllib2
APIs (incompatible withmechanize 0.2.0
) in favor ofmechanize
equivalents. Thanks to John J. Lee for the patch. - Use stdlib
doctest
module, instead ofzope.testing.doctest
. - Caution: This version is no longer fully compatible with Python 2.4:
handleErrors = False
no longer works.
- 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.
- Add
follow
convenience method which gets and follows a link.
- Move
zope.app.testing
dependency into the scope of thePublisherConnection
class. Zope2 specifies its own version ofPublisherConnection
which isn't dependent onzope.app.testing
. - Fix LP #419119: return
None
when the browser has no contents instead of raising an exception.
- Update dependency from
zope.app.publisher
tozope.browserpage
,zope.browserresource
andzope.ptresource
. - Remove dependencies on
zope.app.principalannotation
andzope.securitypolicy
by using the simplePermissiveSecurityPolicy
. - 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
tozope.securitypolicy
.
- Update dependency from
zope.app.folder
tozope.site.folder
. - Remove unnecessary test dependency in
zope.app.component
.
- Update author e-mail to
zope-dev
rather thanzope3-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 newcookies.txt
documentation.
- Work around for a
mechanize
/urllib2
bug on Python 2.6 missingtimeout
attribute onRequest
base class. - Work around for a
mechanize
/urllib2
bug in creating request objects that won't handle fragment URLs correctly.
- 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 themechanize
project. - Fix https://bugs.launchpad.net/bugs/149517 by adding
zope.interface
andzope.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.
- Resolve
ZopeSecurityPolicy
deprecation warning.
- Update dependencies to
mechanize 0.1.7b
andClientForm 0.2.7
. - Add support for Python 2.5.
- 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.
Initial release as a separate project, corresponds to zope.testbrowser from Zope 3.4.0a1