Skip to content

Commit

Permalink
Merge pull request #394 from collective/maurits-3x-ci
Browse files Browse the repository at this point in the history
Several CI fixes for 3.x.
  • Loading branch information
mauritsvanrees authored Jan 16, 2023
2 parents 2dca5a1 + 8a121d7 commit 6f73b27
Show file tree
Hide file tree
Showing 16 changed files with 21 additions and 143 deletions.
5 changes: 1 addition & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,5 @@ Compatibility

- 1.x targets Plone 4.x
- 2.x targets Plone 5.x onwards
- 3.x targets Plone 5.2
- 3.x targets Plone 5.2, on Python 2.7, 3.7, 3.8
- 4.x targets Plone 6, on Python 3

The community might decide to let latest 4.x only support Plone 6, and 3.x only support Plone 5.
See `discussion in issue 341 <https://github.com/collective/collective.easyform/issues/341>`_.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
zc.buildout==3.0.0rc3
zc.buildout==3.0.1
setuptools==44.1.1
wheel==0.37.1
pip==20.3.4
3 changes: 0 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@
"Environment :: Web Environment",
"Framework :: Plone",
"Framework :: Plone :: Addon",
"Framework :: Plone :: 5.0",
"Framework :: Plone :: 5.1",
"Framework :: Plone :: 5.2",
"Programming Language :: Python",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Operating System :: OS Independent",
Expand Down
1 change: 0 additions & 1 deletion src/collective/easyform/browser/likert.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import zope.component
import zope.interface
import zope.schema.interfaces
from zope.pagetemplate.interfaces import IPageTemplate
from plone.memoize.view import memoize

from z3c.form import interfaces
Expand Down
1 change: 0 additions & 1 deletion src/collective/easyform/browser/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from Products.Five.browser.metaconfigure import ViewMixinForTemplates
from z3c.form import interfaces
from z3c.form.browser import widget
from z3c.form.interfaces import IWidget
from z3c.form.widget import FieldWidget
from z3c.form.widget import Widget
from zope.browserpage.viewpagetemplatefile import ViewPageTemplateFile
Expand Down
6 changes: 2 additions & 4 deletions src/collective/easyform/serializer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import datetime
from datetime import date, datetime
import imp
import pdb
from datetime import date
from datetime import datetime
from dateutil import parser
import json
import logging
Expand Down
3 changes: 2 additions & 1 deletion src/collective/easyform/tests/attachment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ Submit the form with an image attachment::
>>> browser.getControl('Your E-Mail Address').value = 'test@example.com'
>>> browser.getControl('Subject').value = 'test'
>>> browser.getControl('Comments').value = 'PFG rocks!'
>>> browser.getControl(name='form.widgets.attachment').add_file(open(get_image_path(), 'rb'), 'image/png', 'test.png')
>>> with open(get_image_path(), 'rb') as image_file:
... browser.getControl(name='form.widgets.attachment').add_file(image_file, 'image/png', 'test.png')
>>> browser.getControl('Submit').click()
<sent mail from ...to ['mdummy@address.com']>
>>> 'Thanks for your input.' in browser.contents
Expand Down
2 changes: 1 addition & 1 deletion src/collective/easyform/tests/testCustomScript.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"""
from AccessControl import ClassSecurityInfo
from AccessControl import Unauthorized
from App.class_init import InitializeClass
from AccessControl.class_init import InitializeClass
from collective.easyform.api import get_actions
from collective.easyform.tests import base
from plone.app.testing import logout
Expand Down
18 changes: 9 additions & 9 deletions src/collective/easyform/tests/testLikert.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ def test_validate_with_more_answers(self):
def test_parse(self):
field = self._makeOne(required=False, questions=[u'Question 1', u'Question 2'], answers=[u'Agree', u'Disagree'])
field.validate(None)
self.assertEquals(dict(), field.parse(u''))
self.assertEquals({1: u'Agree'}, field.parse(u'1: Agree'))
self.assertEquals({2: u'Agree'}, field.parse(u'2: Agree'))
self.assertEquals(
self.assertEqual(dict(), field.parse(u''))
self.assertEqual({1: u'Agree'}, field.parse(u'1: Agree'))
self.assertEqual({2: u'Agree'}, field.parse(u'2: Agree'))
self.assertEqual(
{1: u'Disagree', 2: u'Agree'},
field.parse(u'1: Disagree, 2: Agree')
)
Expand Down Expand Up @@ -124,24 +124,24 @@ def test_likert_saved(self):
rendered = data_view()
from bs4 import BeautifulSoup
radio_buttons = BeautifulSoup(rendered, 'html.parser').find_all(type="radio")
self.assertEquals(len(radio_buttons), 4) # 2 rows of 2 answers
self.assertEqual(len(radio_buttons), 4) # 2 rows of 2 answers

# First question: answered Agree -> Agree input checked
self.assertTrue("0_0" in radio_buttons[0]['id'])
self.assertEquals(radio_buttons[0]['value'], "Agree")
self.assertEqual(radio_buttons[0]['value'], "Agree")
self.assertTrue(radio_buttons[0].has_attr('checked'))

# First question: answered Agree -> Disagree input not checked
self.assertTrue("0_1" in radio_buttons[1]['id'])
self.assertEquals(radio_buttons[1]['value'], "Disagree")
self.assertEqual(radio_buttons[1]['value'], "Disagree")
self.assertFalse(radio_buttons[1].has_attr('checked'))

# Second question: answered Disagree -> Agree input not checked
self.assertTrue("1_0" in radio_buttons[2]['id'])
self.assertEquals(radio_buttons[2]['value'], "Agree")
self.assertEqual(radio_buttons[2]['value'], "Agree")
self.assertFalse(radio_buttons[2].has_attr('checked'))

# Second question: answered Disagree -> Disagree input checked
self.assertTrue("1_1" in radio_buttons[3]['id'])
self.assertEquals(radio_buttons[3]['value'], "Disagree")
self.assertEqual(radio_buttons[3]['value'], "Disagree")
self.assertTrue(radio_buttons[3].has_attr('checked'))
2 changes: 0 additions & 2 deletions src/collective/easyform/tests/testMailer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@
from plone.app.textfield.value import RichTextValue
from plone.namedfile.file import NamedFile
from Products.CMFPlone.utils import safe_unicode
from six import StringIO
from six import BytesIO

import datetime
import six


try:
Expand Down
46 changes: 0 additions & 46 deletions src/collective/easyform/tests/testSetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@
import Products


try:
from Products.CMFPlone.utils import get_installer
except ImportError:
# BBB for Plone 5.0 and lower.
get_installer = None


def getAddPermission(product, name):
"""find the add permission for a meta_type"""

Expand Down Expand Up @@ -100,45 +93,6 @@ def testActionsInstalled(self):
self.portal.portal_actions.getActionInfo("object_buttons/saveddata")
)

def testModificationsToPropSheetLinesNotPuged(self):
property_mappings = [
{
"propsheet": "site_properties",
"added_props": [
"use_folder_tabs",
"typesLinkToFolderContentsInFC",
"default_page_types",
],
}
]

# add garbage prop element to each lines property
for mapping in property_mappings:
sheet = self.properties[mapping["propsheet"]]
for lines_prop in mapping["added_props"]:
propitems = list(sheet.getProperty(lines_prop))
propitems.append("foo")
sheet.manage_changeProperties({lines_prop: propitems})

# reinstall
if get_installer is None:
qi = self.portal["portal_quickinstaller"]
else:
qi = get_installer(self.portal)
qi.reinstallProducts(["collective.easyform"])

# now make sure our garbage values survived the reinstall
for mapping in property_mappings:
sheet = self.properties[mapping["propsheet"]]
for lines_prop in mapping["added_props"]:
self.assertTrue(
"foo" in sheet.getProperty(lines_prop),
"Our garbage item didn't survive reinstall for property "
"{0} within property sheet {1}".format(
lines_prop, mapping["propsheet"]
),
)

def test_EasyFormInDefaultPageTypes(self):
values = api.portal.get_registry_record("plone.default_page_types")
self.assertIn("EasyForm", values)
Expand Down
4 changes: 2 additions & 2 deletions src/collective/easyform/tests/testValidators.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from Products.validation import validation
from z3c.form.interfaces import IFormLayer
from zope.component import getUtility
from zope.component.interfaces import ComponentLookupError
from zope.interface.interfaces import ComponentLookupError
from zope.i18n import translate
from zope.interface import classImplements
from ZPublisher.BaseRequest import BaseRequest
Expand Down Expand Up @@ -460,7 +460,7 @@ class TestSingleHcaptchaValidator(LoadFixtureBase):
Copy/paste test from Recaptcha, same api & add'on
structure
"""

schema_fixture = "hcaptcha.xml"

def afterSetUp(self):
Expand Down
27 changes: 0 additions & 27 deletions tests-5.0.x.cfg

This file was deleted.

24 changes: 0 additions & 24 deletions tests-5.1.x.cfg

This file was deleted.

18 changes: 2 additions & 16 deletions tests-5.2.x.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,18 @@ package-name = collective.easyform
package-extras = [test,recaptcha,downloadxlsx,patternslib]
test-eggs =

# Python3 compatibility for plone.formwidget.z3cform is not released
extensions +=
mr.developer
sources = sources
sources-dir = share
auto-checkout +=
plone.formwidget.recaptcha

[versions]
setuptools =
zc.buildout =
plone.app.mosaic =
plone.app.robotframework = 1.5.0
openpyxl = 2.6.3
et-xmlfile = <1.1.0
et-xmlfile = <1.1.0
plone.formwidget.hcaptcha = >=1.0.2
# check-manifest = 0.45 requires 'build' 0.1.0.
# This requires a newer 'pep517' than is pinned by Plone,
# and on Python 2.7 a newer virtualenv than is pinned by Plone.
check-manifest = 0.44

[versions:python27]
check-manifest = 0.41

[sources]
plone.formwidget.recaptcha = git ${remotes:plone}/plone.formwidget.recaptcha.git pushurl=${remotes:plone_push}/plone.formwidget.recaptcha.git

[remotes]
plone = https://github.com/plone
plone_push = git@github.com:plone
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tox]
minversion = 3.18
envlist =
plone52-py{27,36,37,38}
plone52-py{27,37,38}

[testenv]
# We do not install with pip, but with buildout:
Expand Down

0 comments on commit 6f73b27

Please sign in to comment.