Skip to content

Commit

Permalink
check whether avoiding exception in RealUpgradeLayer setup avoids pol…
Browse files Browse the repository at this point in the history
…luting test environment
  • Loading branch information
davisagli authored and jensens committed Feb 5, 2017
1 parent 7e28593 commit 9601ec4
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions plone/app/upgrade/v50/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
from plone.testing.z2 import FunctionalTesting, login
from zope.component.hooks import setSite
from zope.configuration import xmlconfig
import logging
import os

logger = logging.getLogger(__file__)


class RealUpgradeLayer(PloneSandboxLayer):
defaultBases = (PLONE_FIXTURE,)
Expand All @@ -25,15 +28,18 @@ def setUpPloneSite(self, portal):
login(app['acl_users'], 'admin')

# import old ZEXP
path = os.path.join(os.path.abspath(
os.path.dirname(__file__)), 'data', 'test-full.zexp')
app._importObjectFromFile(path, verify=0)

# run upgrades
self['portal'] = portal = app.test
setSite(portal)
portal.portal_migration.upgrade(swallow_errors=False)
setSite(None)
try:
path = os.path.join(os.path.abspath(
os.path.dirname(__file__)), 'data', 'test-full.zexp')
app._importObjectFromFile(path, verify=0)
except:
logger.exception('Failed to import ZEXP from old site.')
else:
# run upgrades
self['portal'] = portal = app.test
setSite(portal)
portal.portal_migration.upgrade(swallow_errors=False)
setSite(None)

def tearDownPloneSite(self, portal):
del self['portal']
Expand Down

0 comments on commit 9601ec4

Please sign in to comment.