zope.app.testing.functional does not support blobstorage

Bug #219845 reported by Christophe Combelles
4
Affects Status Importance Assigned to Milestone
Zope 3
Won't Fix
Wishlist
Unassigned
zope.app.testing
Confirmed
Low
Christian Theune

Bug Description

zope.app.testing.functional uses a DemoStorage for the tests.
This leads to an error when trying to upload a blob such as zope.file.file.File, with the testbrowser:

(...)
    >>> browser.handleErrors = False
    >>> from StringIO import StringIO
    >>> browser.open('http://localhost/+/action.html?type_name=zope.file.File')
    >>> browser.getControl(name='form.data').add_file(StringIO('file content'),
    ... 'text/plain', 'toto.txt')
    >>> browser.getControl(name='form.actions.add').click()
Traceback (most recent call last):
...
Unsupported: Storing Blobs in <ZODB.DemoStorage.DemoStorage instance at 0xb6ffddec> is not supported.

Projects using blobs customize the setUp themselves to be able to use a blobstorage in their tests, like in z3c.blobfile:

http://svn.zope.org/z3c.blobfile/trunk/src/z3c/blobfile/testing.py?rev=81850&view=markup

It would be better to directly add blobstorage support in zope.app.testing.functional to avoid replicating all this in each project.

Revision history for this message
Christian Zagrodnick (zagy) wrote :

zope.app.testing.functional should probably use zc.demostorage2 as well instead of plain demostorage.

Revision history for this message
Christophe Combelles (ccomb) wrote :

Fortunately there is a quick way to do functional tests with blobs :

Use :
from zope.file.testing import FunctionalBlobDocFileSuite
instead of :
from zope.app.testing.functional.FunctionalDocFileSuite

However, since zope.file already depends on zope.app.testing, it would be better to move the blob testing support from zope.file to zope.app.testing.

Changed in zope3:
importance: Undecided → Wishlist
Revision history for this message
Christian Theune (ctheune) wrote :

I think this might have fixed itself with newer ZODB versions as their DemoStorages should support blobs right away. I'll look into this (hopefully on the next bug day) and maybe write a test that proves this.

Changed in zope3:
status: New → Confirmed
status: Confirmed → Won't Fix
Changed in zope.app.testing:
assignee: nobody → Christian Theune (ct-gocept)
importance: Undecided → Low
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.