Skip to content

Commit

Permalink
stack demostorage only for one test, where it is needed.
Browse files Browse the repository at this point in the history
  • Loading branch information
jensens committed Oct 1, 2018
1 parent 0846690 commit fc1faab
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
13 changes: 1 addition & 12 deletions plone/namedfile/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from plone.testing import Layer
from plone.testing import publisher
from plone.testing import zca
from plone.testing import zodb

from plone.testing import zope
from zope.configuration import xmlconfig

Expand All @@ -17,18 +17,7 @@ def setUp(self):
import plone.namedfile
xmlconfig.file('testing.zcml', plone.namedfile)

self['zodbDB_before_namedfile'] = self.get('zodbDB')
self['zodbDB'] = zodb.stackDemoStorage(
self.get('zodbDB'),
name='NamedFileFixture'
)

def tearDown(self):
# Zap the stacked ZODB
self['zodbDB'].close()
self['zodbDB'] = self['zodbDB_before_namedfile']
del self['zodbDB_before_namedfile']

# Zap the stacked zca context
zca.popGlobalRegistry()

Expand Down
11 changes: 11 additions & 0 deletions plone/namedfile/tests/test_scaling_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from plone.namedfile.scaling import ImageScaling
from plone.namedfile.testing import PLONE_NAMEDFILE_FUNCTIONAL_TESTING
from plone.namedfile.tests import getFile
from plone.testing import zodb
from plone.testing.zope import Browser
from six import BytesIO
from zope.annotation import IAttributeAnnotatable
Expand Down Expand Up @@ -52,6 +53,11 @@ class ImagePublisherTests(unittest.TestCase):
layer = PLONE_NAMEDFILE_FUNCTIONAL_TESTING

def setUp(self):
self.layer['zodbDB_before_namedfile'] = self.layer.get('zodbDB')
self.layer['zodbDB'] = zodb.stackDemoStorage(
self.layer.get('zodbDB'),
name='NamedFileFixture'
)
data = getFile('image.png')
item = DummyContent()
item.image = NamedImage(data, 'image/png', u'image.png')
Expand All @@ -67,6 +73,11 @@ def setUp(self):
def tearDown(self):
ImageScaling._sizes = self._orig_sizes

# Zap the stacked ZODB
# self['zodbDB'].close()
self.layer['zodbDB'] = self.layer['zodbDB_before_namedfile']
del self.layer['zodbDB_before_namedfile']

def testPublishScaleViaUID(self):
scale = self.view.scale('image', width=64, height=64)
transaction.commit()
Expand Down

1 comment on commit fc1faab

@jenkins-plone-org

This comment was marked as outdated.

Please sign in to comment.