From ac96ce921e0800400504201b1d4c7a3f78dcbf0c Mon Sep 17 00:00:00 2001 From: hvelarde Date: Thu, 9 Aug 2018 18:04:39 -0300 Subject: [PATCH 1/2] Refactor test fixture to load Dexterity content types when available --- .travis.yml | 6 +++--- src/collective/cover/testing.py | 24 +++++------------------- versions-4.3.x.cfg | 1 - 3 files changed, 8 insertions(+), 23 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5d7e1c8bd..3e37dfd5c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,7 @@ addons: env: matrix: - PLONE_VERSION=4.3 - - PLONE_VERSION=4.3 DEXTERITY_ONLY=true + - PLONE_VERSION=4.3 TEST_EGGS=buildout:test-eggs=plone.app.contenttypes - PLONE_VERSION=4.3 VERSIONS=versions:plone.app.jquery=1.9.2 - PLONE_VERSION=5.1 matrix: @@ -29,8 +29,8 @@ install: - sed -ie "s#test-4.3#test-$PLONE_VERSION#" buildout.cfg - sed -ie "s#versions-4.3#versions-$PLONE_VERSION#" buildout.cfg - python bootstrap.py -- bin/buildout $VERSIONS annotate -- bin/buildout $VERSIONS +- bin/buildout $TEST_EGGS $VERSIONS annotate +- bin/buildout $TEST_EGGS $VERSIONS before_script: - export ROBOT_SELENIUM2LIBRARY_RUN_ON_FAILURE="Capture Page Screenshot" - export DISPLAY=:99.0 diff --git a/src/collective/cover/testing.py b/src/collective/cover/testing.py index 4aa9ddb8a..f117e7c22 100644 --- a/src/collective/cover/testing.py +++ b/src/collective/cover/testing.py @@ -17,7 +17,6 @@ from plone.app.robotframework.testing import AUTOLOGIN_LIBRARY_FIXTURE from plone.app.testing import FunctionalTesting from plone.app.testing import IntegrationTesting -from plone.app.testing import PLONE_FIXTURE from plone.app.testing import PloneSandboxLayer from plone.testing import z2 @@ -29,10 +28,11 @@ try: pkg_resources.get_distribution('plone.app.contenttypes') except pkg_resources.DistributionNotFound: + from plone.app.testing import PLONE_FIXTURE DEXTERITY_ONLY = False else: - # this environment variable is set in .travis.yml test matrix - DEXTERITY_ONLY = os.environ.get('DEXTERITY_ONLY') is not None + from plone.app.contenttypes.testing import PLONE_APP_CONTENTTYPES_FIXTURE as PLONE_FIXTURE + DEXTERITY_ONLY = True # XXX: PFG tile is deprecated and will be removed in collective.cover 3 @@ -119,7 +119,7 @@ def generate_jpeg(width, height): # FIXME: workaround for https://github.com/plone/plone.app.testing/issues/39 # Products.TinyMCE is used only in Plone 4 -if not IS_PLONE_5: +if not DEXTERITY_ONLY: autoform = ('plone.autoform', {'loadZCML': True}) tinymce = ('Products.TinyMCE', {'loadZCML': True}) products = list(PLONE_FIXTURE.products) @@ -132,19 +132,11 @@ class Fixture(PloneSandboxLayer): defaultBases = (PLONE_FIXTURE,) def setUpZope(self, app, configurationContext): - if IS_PLONE_5: - import plone.app.contenttypes - self.loadZCML(package=plone.app.contenttypes) - else: + if not IS_PLONE_5: # needed by plone.app.linkintegrity under Plone 4.x import plone.app.referenceablebehavior self.loadZCML(package=plone.app.referenceablebehavior) - if DEXTERITY_ONLY: - import plone.app.contenttypes - self.loadZCML(package=plone.app.contenttypes) - z2.installProduct(app, 'Products.DateRecurringIndex') - if HAS_PFG: import Products.PloneFormGen self.loadZCML(package=Products.PloneFormGen) @@ -161,12 +153,6 @@ def setUpZope(self, app, configurationContext): manage_addVirtualHostMonster(app, 'virtual_hosting') def setUpPloneSite(self, portal): - if IS_PLONE_5: - self.applyProfile(portal, 'plone.app.contenttypes:default') - else: - if DEXTERITY_ONLY: - self.applyProfile(portal, 'plone.app.contenttypes:default') - if HAS_PFG: self.applyProfile(portal, 'Products.PloneFormGen:default') diff --git a/versions-4.3.x.cfg b/versions-4.3.x.cfg index 99e78872d..babcfffe1 100644 --- a/versions-4.3.x.cfg +++ b/versions-4.3.x.cfg @@ -1,6 +1,5 @@ [buildout] test-eggs = - plone.app.contenttypes plone.app.referenceablebehavior Products.PloneFormGen From 01f70e3d1179d955c81d659658826db0a02bb6cc Mon Sep 17 00:00:00 2001 From: hvelarde Date: Thu, 23 Aug 2018 16:01:02 -0300 Subject: [PATCH 2/2] Fix typo --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3e37dfd5c..1d3132309 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,7 @@ addons: env: matrix: - PLONE_VERSION=4.3 - - PLONE_VERSION=4.3 TEST_EGGS=buildout:test-eggs=plone.app.contenttypes + - PLONE_VERSION=4.3 TEST_EGGS=buildout:test-eggs+=plone.app.contenttypes - PLONE_VERSION=4.3 VERSIONS=versions:plone.app.jquery=1.9.2 - PLONE_VERSION=5.1 matrix: