Skip to content

Commit

Permalink
On Python 3 in testMigrationTool only test upgrade from Plone 5.2.
Browse files Browse the repository at this point in the history
You cannot upgrade a Plone 4.0 or 5.1 site to 5.2 or higher when you are on Python 3.
You must first migrate to 5.2 with Python 2.7.
Also, this avoids a test failure on 6.0 because the 5.0alpha upgrade calls qi.isProductInstalled, which has been removed.
  • Loading branch information
mauritsvanrees authored and thet committed Oct 13, 2020
1 parent 8ef18e4 commit 2259ee7
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions Products/CMFPlone/tests/testMigrationTool.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
from Products.CMFPlone.factory import _DEFAULT_PROFILE
from Products.CMFCore.utils import getToolByName

import sys


if sys.version_info.major == 2:
# Start a test upgrade at version 2.5.
# The first existing upgrade step will immediately put it at 4001.
START_PROFILE = '2.5'
else:
# Python 3 is only supported on 5.2+.
# This means you can not upgrade from 5.1 or earlier.
START_PROFILE = '5200'


class TestMigrationTool(PloneTestCase.PloneTestCase):

Expand Down Expand Up @@ -39,8 +51,7 @@ def testListOwnUpgradeSteps(self):

def testDoUpgrades(self):
self.setRoles(['Manager'])

self.setup.setLastVersionForProfile(_DEFAULT_PROFILE, '2.5')
self.setup.setLastVersionForProfile(_DEFAULT_PROFILE, START_PROFILE)
upgrades = self.migration.listUpgrades()
self.assertGreater(len(upgrades), 0)

Expand Down Expand Up @@ -69,7 +80,7 @@ def testDoUpgrades(self):

def testUpgrade(self):
self.setRoles(['Manager'])
self.setup.setLastVersionForProfile(_DEFAULT_PROFILE, '2.5')
self.setup.setLastVersionForProfile(_DEFAULT_PROFILE, START_PROFILE)
self.migration.upgrade()

# And we have reached our current profile version
Expand Down Expand Up @@ -130,7 +141,7 @@ def testListUpgradeStepsNotTooNew(self):

def testUpgrade(self):
self.setRoles(['Manager'])
self.setup.setLastVersionForProfile(_DEFAULT_PROFILE, '2.5')
self.setup.setLastVersionForProfile(_DEFAULT_PROFILE, START_PROFILE)
self.migration.upgrade()

# And we have reached our current profile version
Expand Down

0 comments on commit 2259ee7

Please sign in to comment.