On Mon, 2005-12-12 at 18:06 -0500, Paul Winkler wrote:
[...]
> ############# toward the end of
> # tests/testtests/test_AcceleratedHTTPCacheManager.py #############
> 
>     def test_XXXinterface(self):
>         url = 'http://www.google.com'
>         from Products.StandardCacheManagers.interfaces import IHTTPConnection
>         conn = IHTTPConnection(url)
> 
> #####################################################################
> 
> 
> This raises an error, regardless of whether I remove the registration of 
> IString or not:
[...]
> TypeError: ('Could not adapt', 'http://www.google.com', <InterfaceClass
> Products.StandardCacheManagers.interfaces.IHTTPConnection>)

In unittests the ZCML-Directives are not used so you have to do the
things from ZCML in your test-code before adaption.

from zope.interface import classImplements
from zope.app.testing import ztapi

classImplements(str, IString)
ztapi.provideAdapter(IString, IHTTPConnection, HTTPConnection)

HTH,
 mac

_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to