Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/plone-package-test-gha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ jobs:
test:
runs-on: gha-runners-smartweb
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.12']
plone-version: ['6.0', '6.1']
python-version: ['3.10', '3.11', '3.12', '3.13']
steps:
- name: Checkout codebase
uses: actions/checkout@v4
Expand All @@ -34,6 +36,8 @@ jobs:
with:
CACHE_KEY: eggs-test-${{ hashFiles('base.cfg') }}-python-${{ matrix.python-version }}
TEST_COMMAND: TZ=UTC bin/test
BUILDOUT_CONFIG_FILE: 'test_plone-${{ matrix.plone-version }}.cfg'
REQUIREMENTS_FILE: 'requirements-${{ matrix.plone-version }}.txt'
MATTERMOST_WEBHOOK_URL: ${{ secrets.SMARTWEB_MATTERMOST_WEBHOOK_URL }}
PYTHON_VERSION: ${{ matrix.python-version }}

Expand All @@ -53,4 +57,3 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: coveralls --service=github

6 changes: 5 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ Changelog
1.2.28 (unreleased)
-------------------

- Nothing changed yet.
- Upgrade dev environment to Plone 6.1-latest
[remdub]

- Add tests for Plone 6.1-latest and add Python 3.13
[remdub]


1.2.27 (2025-03-19)
Expand Down
File renamed without changes.
65 changes: 65 additions & 0 deletions base-6.1.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
[buildout]
show-picked-versions = true
extensions =
mr.developer

sources-dir = devel

extends =
https://dist.plone.org/release/6.1-latest/versions.cfg
https://dist.plone.org/release/6.1-latest/versions-ecosystem.cfg
https://dist.plone.org/release/6.1-latest/versions-extra.cfg
https://raw.githubusercontent.com/IMIO/buildout.smartweb/main/versions.cfg
https://raw.githubusercontent.com/IMIO/buildout.smartweb/main/sources.cfg

parts =
instance
# releaser
omelette
plone-helper-scripts
vscode

develop = .

auto-checkout +=
imio.smartweb.locales

[instance]
recipe = plone.recipe.zope2instance
zodb-temporary-storage = off
user = admin:admin
http-address = 8080
environment-vars =
zope_i18n_compile_mo_files true
eggs =
Plone
Pillow
imio.smartweb.common
zcml =
imio.smartweb.common

[vscode]
recipe = collective.recipe.vscode
eggs = ${instance:eggs}
autocomplete-use-omelette = True

[omelette]
recipe = collective.recipe.omelette
eggs = ${instance:eggs}

[releaser]
recipe = zc.recipe.egg
eggs = zest.releaser

[plone-helper-scripts]
recipe = zc.recipe.egg
eggs =
Products.CMFPlone
${instance:eggs}
interpreter = zopepy
scripts =
zopepy

[versions]
# Don't use a released version of imio.smartweb.common
imio.smartweb.common =
2 changes: 1 addition & 1 deletion buildout.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
# use this extend one of the buildout configuration:
extends =
# -*- mrbob: extra extends -*-
test_plone6.cfg
test_plone-6.0.cfg
File renamed without changes.
1 change: 1 addition & 0 deletions requirements-6.1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-r https://dist.plone.org/release/6.1-latest/requirements.txt
2 changes: 1 addition & 1 deletion requirements-coverage.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
-r requirements.txt
-r requirements-6.0.txt
coveralls==3.2.0
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@
"Framework :: Plone",
"Framework :: Plone :: Addon",
"Framework :: Plone :: 6.0",
"Framework :: Plone :: 6.1",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Operating System :: OS Independent",
"License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
],
Expand Down
1 change: 0 additions & 1 deletion src/imio/smartweb/common/adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from plone.namedfile.interfaces import IAvailableSizes
from plone.namedfile.interfaces import INamedImageField
from plone.namedfile.field import InvalidImageFile
from plone.namedfile.utils import get_contenttype
from zope.component import adapter
from zope.component import getUtility
from zope.interface import Interface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@

from collective.taxonomy.interfaces import ITaxonomy
from collective.taxonomy.jsonimpl import EditTaxonomyData as baseEditTaxonomyData
from imio.smartweb.locales import SmartwebMessageFactory as _
from plone import api
from zope.component import queryUtility
from zope.component import queryUtility
from plone import api
from Products.Five import BrowserView


Expand Down
133 changes: 96 additions & 37 deletions src/imio/smartweb/common/tests/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

from imio.smartweb.common.testing import IMIO_SMARTWEB_COMMON_INTEGRATION_TESTING
from imio.smartweb.common.widgets.select import TranslatedAjaxSelectWidget
from importlib.metadata import version
from plone.api import portal as portal_api
from zope.publisher.browser import TestRequest


import mock
import unittest

Expand All @@ -20,42 +22,99 @@ def test_translated_ajax_select(self):
portal_api.get_current_language = mock.Mock(return_value="fr")
widget = TranslatedAjaxSelectWidget(self.request)
widget.update()
self.assertEqual(
{
"name": None,
"value": "",
"pattern": "select2",
"pattern_options": {"separator": ";"},
},
widget._base_args(),
)

widget.vocabulary = "imio.smartweb.vocabulary.Topics"
self.assertEqual(
widget._base_args(),
{
"name": None,
"value": "",
"pattern": "select2",
"pattern_options": {
"vocabularyUrl": "http://nohost/plone/@@getVocabulary?name=imio.smartweb.vocabulary.Topics",
"separator": ";",
},
},
)
widget.value = "entertainment"
self.assertEqual(
widget._base_args(),
{
"name": None,
"value": "entertainment",
"pattern": "select2",
"pattern_options": {
"vocabularyUrl": "http://nohost/plone/@@getVocabulary?name=imio.smartweb.vocabulary.Topics",
"initialValues": {
"entertainment": "Activités et divertissement",
# __import__("pdb").set_trace()
if version("plone.app.z3cform") < "4.4.0":
self.assertEqual(
{
"name": None,
"value": "",
"pattern": "select2",
"pattern_options": {"separator": ";"},
},
widget._base_args(),
)
widget.vocabulary = "imio.smartweb.vocabulary.Topics"
self.assertEqual(
widget._base_args(),
{
"name": None,
"value": "",
"pattern": "select2",
"pattern_options": {
"vocabularyUrl": "http://nohost/plone/@@getVocabulary?name=imio.smartweb.vocabulary.Topics",
"separator": ";",
},
"separator": ";",
},
},
)
)
widget.value = "entertainment"
self.assertEqual(
widget._base_args(),
{
"name": None,
"value": "entertainment",
"pattern": "select2",
"pattern_options": {
"vocabularyUrl": "http://nohost/plone/@@getVocabulary?name=imio.smartweb.vocabulary.Topics",
"initialValues": {
"entertainment": "Activités et divertissement",
},
"separator": ";",
},
},
)
else:
# _base.args has been removed
# see https://github.com/plone/plone.app.z3cform/commit/5de30e9b117885859680dfe3861f134a667cea9c
self.assertEqual(
{
"name": None,
"value": None,
"pattern": "select2",
"pattern_options": {"separator": ";"},
},
{
"name": widget.name,
"value": widget.value,
"pattern": widget.pattern,
"pattern_options": widget.get_pattern_options(),
},
)
widget.vocabulary = "imio.smartweb.vocabulary.Topics"
self.assertEqual(
{
"name": None,
"value": None,
"pattern": "select2",
"pattern_options": {
"vocabularyUrl": "http://nohost/plone/@@getVocabulary?name=imio.smartweb.vocabulary.Topics",
"separator": ";",
},
},
{
"name": widget.name,
"value": widget.value,
"pattern": widget.pattern,
"pattern_options": widget.get_pattern_options(),
},
)
widget.value = "entertainment"
self.assertEqual(
{
"name": None,
"value": "entertainment",
"pattern": "select2",
"pattern_options": {
"vocabularyUrl": "http://nohost/plone/@@getVocabulary?name=imio.smartweb.vocabulary.Topics",
"initialValues": {
"entertainment": "Activités et divertissement",
},
"separator": ";",
},
},
{
"name": widget.name,
"value": widget.value,
"pattern": widget.pattern,
"pattern_options": widget.get_pattern_options(),
},
)
2 changes: 1 addition & 1 deletion test_plone6.cfg → test_plone-6.0.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[buildout]
extends =
https://raw.githubusercontent.com/collective/buildout.plonetest/master/qa.cfg
base.cfg
base-6.0.cfg

parts +=
code-analysis
Expand Down
51 changes: 51 additions & 0 deletions test_plone-6.1.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
[buildout]
extends =
https://raw.githubusercontent.com/collective/buildout.plonetest/master/qa.cfg
base-6.1.cfg

parts +=
code-analysis
test
coverage
test-coverage
createcoverage
robot

[code-analysis]
flake8-ignore = E501,W503,E203

[test]
recipe = zc.recipe.testrunner
eggs =
${instance:eggs}
imio.smartweb.common [test]
initialization =
os.environ['TZ'] = 'UTC'
defaults = ['-s', 'imio.smartweb.common', '--auto-color', '--auto-progress']
environment = testenv

[testenv]
zope_i18n_compile_mo_files = true

[coverage]
recipe = zc.recipe.egg
eggs = coverage

[test-coverage]
recipe = collective.recipe.template
input = inline:
#!/bin/bash
export TZ=UTC
${buildout:directory}/bin/coverage run bin/test $*
${buildout:directory}/bin/coverage html
${buildout:directory}/bin/coverage report -m --fail-under=90
# Fail (exit status 1) if coverage returns exit status 2 (this happens
# when test coverage is below 100%.
output = ${buildout:directory}/bin/test-coverage
mode = 755

[robot]
recipe = zc.recipe.egg
eggs =
${test:eggs}
plone.app.robotframework[debug,reload]