Basil Shubin wrote:
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()

I have got:

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
File "/usr/lib/python2.4/site-packages/zope/testbrowser/", line 220, in open, data)
File "/usr/lib/python2.4/site-packages/mechanize/", line 254, in open
    return self._mech_open(url, data)
File "/usr/lib/python2.4/site-packages/mechanize/", line 277, in _mech_open
    self._response =, self.request, data)
  File "/usr/lib/python2.4/", line 358, in open
    response = self._open(req, data)
  File "/usr/lib/python2.4/", line 376, in _open
    '_open', req)
  File "/usr/lib/python2.4/", line 337, in _call_chain
    result = func(*args)
File "/usr/lib/python2.4/site-packages/zope/testbrowser/", line 112, in http_open
    return self.do_open(PublisherConnection, req)
  File "/usr/lib/python2.4/", line 993, in do_open
    h.request(req.get_method(), req.get_selector(),, headers)
File "/usr/lib/python2.4/site-packages/zope/testbrowser/", line 69, in request
    self.response = self.caller(request_string, handle_errors)
File "/usr/lib/python2.4/site-packages/zope/app/testing/", line 573, in __call__
File "/usr/lib/python2.4/site-packages/zope/app/testing/", line 606, in chooseRequestClass
    return chooseClasses(method, environment)
File "/usr/lib/python2.4/site-packages/zope/app/publication/", line 33, in chooseClasses
    factory = factoryRegistry.lookup(method, content_type, environment)
File "/usr/lib/python2.4/site-packages/zope/app/publication/", 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?

So is there any solution? Can anybody give me any guidlines about what is correct way to write functional test and test this test. Yes, I have read docs about testing Plone, but above problems still remain unsolved for me...

And how I can predict what should happens after each statement...?


Zope maillist  -
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to