Hi friends, I want use zope.testbrowser for testing my sites, but before write it as DocTest I want execute each statemnt interactively in python shell. I don't know any way to see where it's works, what value it returns, what error I can get and how this error should looks is python... It's why I want check it in python shell. What the problem? First, if execute following code in python shell:
from zope.testbrowser import Browser browser = Browser() browser.open('http://localhost/Plone')
I have got: Traceback (most recent call last): File "<stdin>", line 1, in ? File "/usr/lib/python2.4/site-packages/zope/testbrowser/browser.py", line 220, in open self.mech_browser.open(url, data) File "/usr/lib/python2.4/site-packages/mechanize/_mechanize.py", line 254, in open return self._mech_open(url, data) File "/usr/lib/python2.4/site-packages/mechanize/_mechanize.py", line 277, in _mech_open self._response = UserAgent.open(self, self.request, data) File "/usr/lib/python2.4/urllib2.py", line 358, in open response = self._open(req, data) File "/usr/lib/python2.4/urllib2.py", line 376, in _open '_open', req) File "/usr/lib/python2.4/urllib2.py", line 337, in _call_chain result = func(*args) File "/usr/lib/python2.4/site-packages/zope/testbrowser/testing.py", line 112, in http_open return self.do_open(PublisherConnection, req) File "/usr/lib/python2.4/urllib2.py", line 993, in do_open h.request(req.get_method(), req.get_selector(), req.data, headers) File "/usr/lib/python2.4/site-packages/zope/testbrowser/testing.py", line 69, in request self.response = self.caller(request_string, handle_errors) File "/usr/lib/python2.4/site-packages/zope/app/testing/functional.py", line 573, in __call__ environment) File "/usr/lib/python2.4/site-packages/zope/app/testing/functional.py", line 606, in chooseRequestClass return chooseClasses(method, environment) File "/usr/lib/python2.4/site-packages/zope/app/publication/httpfactory.py", line 33, in chooseClasses factory = factoryRegistry.lookup(method, content_type, environment) File "/usr/lib/python2.4/site-packages/zope/app/publication/requestpublicationregistry.py", line 97, in lookup raise ConfigurationError('No registered publisher found ' zope.configuration.exceptions.ConfigurationError: No registered publisher found for (GET/) Second, if I add Zope src dir into PYTHONPATH, than I got following:
from zope.testbrowser import Browser Running tests at level 1 Total: 0 tests, 0 failures, 0 errors
and than it drops me out from python shell. So, question is: suppose I don't know what value/error I can/should recive after each statement, so how can I write DocTest? I need somehow to know to what I should expect, but how? Thanks for any advices! PS. Sorry for my bad english