[Checkins] SVN: zope.testbrowser/branches/mechanize-2.0/ LP #568806: Update dependency ``mechanize >= 0.2.0``.

Tres Seaver tseaver at palladion.com
Sat Apr 24 08:53:10 EDT 2010


Log message for revision 111347:
  LP #568806: Update dependency ``mechanize >= 0.2.0``.
  
  That version which now includes the ``ClientForm`` APIs.
  

Changed:
  A   zope.testbrowser/branches/mechanize-2.0/
  U   zope.testbrowser/branches/mechanize-2.0/CHANGES.txt
  U   zope.testbrowser/branches/mechanize-2.0/setup.py
  U   zope.testbrowser/branches/mechanize-2.0/src/zope/testbrowser/browser.py
  U   zope.testbrowser/branches/mechanize-2.0/src/zope/testbrowser/fixed-bugs.txt
  U   zope.testbrowser/branches/mechanize-2.0/src/zope/testbrowser/interfaces.py
  U   zope.testbrowser/branches/mechanize-2.0/src/zope/testbrowser/testing.py
  U   zope.testbrowser/branches/mechanize-2.0/src/zope/testbrowser/tests.py

-=-
Modified: zope.testbrowser/branches/mechanize-2.0/CHANGES.txt
===================================================================
--- zope.testbrowser/trunk/CHANGES.txt	2010-04-24 11:35:41 UTC (rev 111340)
+++ zope.testbrowser/branches/mechanize-2.0/CHANGES.txt	2010-04-24 12:53:09 UTC (rev 111347)
@@ -5,6 +5,9 @@
 3.8.2 (unreleased)
 ------------------
 
+- LP #568806: Update dependency ``mechanize >= 0.2.0``, which now includes
+  the ``ClientForm`` APIs.
+
 - Use stdlib ``doctest`` module, instead of ``zope.testing.doctest``.
 
 

Modified: zope.testbrowser/branches/mechanize-2.0/setup.py
===================================================================
--- zope.testbrowser/trunk/setup.py	2010-04-24 11:35:41 UTC (rev 111340)
+++ zope.testbrowser/branches/mechanize-2.0/setup.py	2010-04-24 12:53:09 UTC (rev 111347)
@@ -55,9 +55,8 @@
     namespace_packages = ['zope',],
     tests_require = ['zope.testing'],
     install_requires = [
-        'ClientForm',
         # mechanize 0.2.0 folds in ClientForm, makes incompatible API changes
-        'mechanize<0.2dev',
+        'mechanize>=0.2.0',
         'setuptools',
         'zope.interface',
         'zope.schema',

Modified: zope.testbrowser/branches/mechanize-2.0/src/zope/testbrowser/browser.py
===================================================================
--- zope.testbrowser/trunk/src/zope/testbrowser/browser.py	2010-04-24 11:35:41 UTC (rev 111340)
+++ zope.testbrowser/branches/mechanize-2.0/src/zope/testbrowser/browser.py	2010-04-24 12:53:09 UTC (rev 111347)
@@ -25,7 +25,6 @@
 import time
 import urllib2
 
-import ClientForm
 import mechanize
 import zope.interface
 
@@ -41,7 +40,7 @@
     if intermediate:
         if index is None:
             if len(intermediate) > 1:
-                raise ClientForm.AmbiguityError(msg)
+                raise mechanize.AmbiguityError(msg)
             else:
                 return intermediate[0]
         else:
@@ -52,7 +51,7 @@
     raise LookupError(msg)
 
 def controlFactory(control, form, browser):
-    if isinstance(control, ClientForm.Item):
+    if isinstance(control, mechanize.Item):
         # it is a subcontrol
         return ItemControl(control, form, browser)
     else:
@@ -477,7 +476,7 @@
             self.filename = None
             self.content_type = None
 
-        # for some reason ClientForm thinks we shouldn't be able to modify
+        # for some reason mechanize thinks we shouldn't be able to modify
         # hidden fields, but while testing it is sometimes very important
         if self.mech_control.type == 'hidden':
             self.mech_control.readonly = False
@@ -550,7 +549,7 @@
     def displayValue():
         """See zope.testbrowser.interfaces.IListControl"""
         # not implemented for anything other than select;
-        # would be nice if ClientForm implemented for checkbox and radio.
+        # would be nice if mechanize implemented for checkbox and radio.
         # attribute error for all others.
 
         def fget(self):
@@ -699,7 +698,7 @@
         """Initialize the Form
 
         browser - a Browser instance
-        form - a ClientForm instance
+        form - a mechanize.HTMLForm instance
         """
         self.browser = browser
         self.mech_form = form

Modified: zope.testbrowser/branches/mechanize-2.0/src/zope/testbrowser/fixed-bugs.txt
===================================================================
--- zope.testbrowser/trunk/src/zope/testbrowser/fixed-bugs.txt	2010-04-24 11:35:41 UTC (rev 111340)
+++ zope.testbrowser/branches/mechanize-2.0/src/zope/testbrowser/fixed-bugs.txt	2010-04-24 12:53:09 UTC (rev 111347)
@@ -65,8 +65,7 @@
 
 The .getControl() method was sometimes unable to find radio buttons by label.
 
-    >>> import ClientForm
-    >>> # ClientForm._show_debug_messages()
+    >>> # import mechanize._form; mechanize._form._show_debug_messages()
     >>> browser.open('http://localhost/@@/testbrowser/radio.html')
     >>> browser.getControl('One').optionValue
     '1'
@@ -83,7 +82,6 @@
 fragments. We upgraded our dependency to a newer version of mechanize and make
 sure this regression doesn't come back:
 
-    >>> import ClientForm
     >>> browser.open('http://localhost/@@/testbrowser/fragment.html#asdf')
     >>> browser.url
     'http://localhost/@@/testbrowser/fragment.html#asdf'

Modified: zope.testbrowser/branches/mechanize-2.0/src/zope/testbrowser/interfaces.py
===================================================================
--- zope.testbrowser/trunk/src/zope/testbrowser/interfaces.py	2010-04-24 11:35:41 UTC (rev 111340)
+++ zope.testbrowser/branches/mechanize-2.0/src/zope/testbrowser/interfaces.py	2010-04-24 12:53:09 UTC (rev 111347)
@@ -312,14 +312,14 @@
         required=True)
 
     displayOptions = zope.schema.List(
-        # TODO: currently only implemented for select by ClientForm
+        # TODO: currently only implemented for select by mechanize
         title=u"Options",
         description=u"""\
         A list of possible display values for the control.""",
         required=True)
 
     displayValue = zope.schema.Field(
-        # TODO: currently only implemented for select by ClientForm
+        # TODO: currently only implemented for select by mechanize
         title=u"Value",
         description=u"The value of the control, as rendered by the display",
         default=None,

Modified: zope.testbrowser/branches/mechanize-2.0/src/zope/testbrowser/testing.py
===================================================================
--- zope.testbrowser/trunk/src/zope/testbrowser/testing.py	2010-04-24 11:35:41 UTC (rev 111340)
+++ zope.testbrowser/branches/mechanize-2.0/src/zope/testbrowser/testing.py	2010-04-24 12:53:09 UTC (rev 111347)
@@ -144,14 +144,13 @@
     """Special ``mechanize`` browser using the Zope Publisher HTTP handler."""
 
     default_schemes = ['http']
-    default_others = ['_http_error', '_http_request_upgrade',
-                      '_http_default_error']
+    default_others = ['_http_error', '_http_default_error']
     default_features = ['_redirect', '_cookies', '_referer', '_refresh',
                         '_equiv', '_basicauth', '_digestauth']
 
     def __init__(self, *args, **kws):
         inherited_handlers = ['_unknown', '_http_error',
-            '_http_request_upgrade', '_http_default_error', '_basicauth',
+            '_http_default_error', '_basicauth',
             '_digestauth', '_redirect', '_cookies', '_referer',
             '_refresh', '_equiv', '_gzip']
 

Modified: zope.testbrowser/branches/mechanize-2.0/src/zope/testbrowser/tests.py
===================================================================
--- zope.testbrowser/trunk/src/zope/testbrowser/tests.py	2010-04-24 11:35:41 UTC (rev 111340)
+++ zope.testbrowser/branches/mechanize-2.0/src/zope/testbrowser/tests.py	2010-04-24 12:53:09 UTC (rev 111347)
@@ -141,7 +141,6 @@
         "http": FauxHTTPHandler,
 
         "_http_error": mechanize.HTTPErrorProcessor,
-        "_http_request_upgrade": mechanize.HTTPRequestUpgradeProcessor,
         "_http_default_error": urllib2.HTTPDefaultErrorHandler,
 
         # feature handlers
@@ -154,8 +153,7 @@
         }
 
     default_schemes = ["http"]
-    default_others = ["_http_error", "_http_request_upgrade",
-                      "_http_default_error"]
+    default_others = ["_http_error", "_http_default_error"]
     default_features = ["_authen", "_redirect", "_cookies"]
 
 
@@ -483,3 +481,18 @@
     this_file = doctest.DocTestSuite(checker=checker)
 
     return unittest.TestSuite((this_file, readme, fixed_bugs, wire, cookies))
+
+def run_suite(suite):
+    runner = unittest.TextTestRunner(sys.stdout, verbosity=1)
+    result = runner.run(suite)
+    if not result.wasSuccessful():
+        if len(result.errors) == 1 and not result.failures:
+            err = result.errors[0][1]
+        elif len(result.failures) == 1 and not result.errors:
+            err = result.failures[0][1]
+        else:
+            err = "errors occurred; run in verbose mode for details"
+        print err
+
+if __name__ == "__main__":
+    run_suite(test_suite())



More information about the checkins mailing list