From f2383ea91a940c3c7eaa6dcb882adbdf302cc1ac Mon Sep 17 00:00:00 2001 From: Mauro Amico Date: Fri, 15 Nov 2024 15:50:36 +0100 Subject: [PATCH] Config with default template 721299ce (#1) * black * Configuring with plone/meta * Configuring with plone/meta * mxdev * ignore * Configuring with plone/meta * cleanup * setup * Preparing release 1.0.0rc1 * Back to development: 1.0.0rc2 * fix manifest * fix manifest * fix manifest * Preparing release 1.0.0rc2 * Back to development: 1.0.0rc3 --- .editorconfig | 49 ++- .flake8 | 22 ++ .github/workflows/meta.yml | 49 ++- .gitignore | 75 ++-- .meta.toml | 32 ++ .pre-commit-config.yaml | 94 +++++ .travis.yml | 61 ---- CHANGES.rst | 17 +- MANIFEST.in | 2 +- base.cfg | 2 +- dependabot.yml | 11 + mx.ini | 17 + pyproject.toml | 130 +++++++ setup.py | 9 +- .../counter/restapi/services/form_data/csv.py | 4 +- src/collective/formsupport/counter/testing.py | 11 - .../counter/tests/robot/test_example.robot | 66 ---- .../formsupport/counter/tests/test_robot.py | 33 -- tox.ini | 342 ++++++++++-------- 19 files changed, 654 insertions(+), 372 deletions(-) create mode 100644 .flake8 create mode 100644 .meta.toml create mode 100644 .pre-commit-config.yaml delete mode 100644 .travis.yml create mode 100644 dependabot.yml create mode 100644 mx.ini create mode 100644 pyproject.toml delete mode 100644 src/collective/formsupport/counter/tests/robot/test_example.robot delete mode 100644 src/collective/formsupport/counter/tests/test_robot.py diff --git a/.editorconfig b/.editorconfig index a83363b..5b3c112 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,15 +1,56 @@ +# Generated from: +# https://github.com/plone/meta/tree/main/config/default +# See the inline comments on how to expand/tweak this configuration file +# +# EditorConfig Configuration file, for more details see: +# http://EditorConfig.org +# EditorConfig is a convention description, that could be interpreted +# by multiple editors to enforce common coding conventions for specific +# file types + +# top-most EditorConfig file: +# Will ignore other EditorConfig files in Home directory or upper tree level. +root = true + + [*] -indent_style = space +# Default settings for all files. +# Unix-style newlines with a newline ending every file end_of_line = lf insert_final_newline = true trim_trailing_whitespace = true +# Set default charset charset = utf-8 +# Indent style default +indent_style = space +# Max Line Length - a hard line wrap, should be disabled +max_line_length = off -[{*.py,*.cfg}] +[*.{py,cfg,ini}] +# 4 space indentation indent_size = 4 -[{*.html,*.dtml,*.pt,*.zpt,*.xml,*.zcml,*.js}] +[*.{yml,zpt,pt,dtml,zcml,html,xml}] +# 2 space indentation indent_size = 2 -[Makefile] +[*.{json,jsonl,js,jsx,ts,tsx,css,less,scss}] +# Frontend development +# 2 space indentation +indent_size = 2 +max_line_length = 80 + +[{Makefile,.gitmodules}] +# Tab indentation (no size specified, but view as 4 spaces) indent_style = tab +indent_size = unset +tab_width = unset + + +## +# Add extra configuration options in .meta.toml: +# [editorconfig] +# extra_lines = """ +# _your own configuration lines_ +# """ +## diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..38918f4 --- /dev/null +++ b/.flake8 @@ -0,0 +1,22 @@ +# Generated from: +# https://github.com/plone/meta/tree/main/config/default +# See the inline comments on how to expand/tweak this configuration file +[flake8] +doctests = 1 +ignore = + # black takes care of line length + E501, + # black takes care of where to break lines + W503, + # black takes care of spaces within slicing (list[:]) + E203, + # black takes care of spaces after commas + E231, + +## +# Add extra configuration options in .meta.toml: +# [flake8] +# extra_lines = """ +# _your own configuration lines_ +# """ +## diff --git a/.github/workflows/meta.yml b/.github/workflows/meta.yml index d04106c..97d9123 100644 --- a/.github/workflows/meta.yml +++ b/.github/workflows/meta.yml @@ -13,6 +13,16 @@ on: - main workflow_dispatch: +## +# To set environment variables for all jobs, add in .meta.toml: +# [github] +# env = """ +# debug: 1 +# image-name: 'org/image' +# image-tag: 'latest' +# """ +## + jobs: qa: uses: plone/meta/.github/workflows/qa.yml@main @@ -20,7 +30,42 @@ jobs: uses: plone/meta/.github/workflows/test.yml@main coverage: uses: plone/meta/.github/workflows/coverage.yml@main - dependencies: - uses: plone/meta/.github/workflows/dependencies.yml@main release_ready: uses: plone/meta/.github/workflows/release_ready.yml@main + +## +# To modify the list of default jobs being created add in .meta.toml: +# [github] +# jobs = [ +# "qa", +# "test", +# "coverage", +# "dependencies", +# "release_ready", +# "circular", +# ] +## + +## +# To request that some OS level dependencies get installed +# when running tests/coverage jobs, add in .meta.toml: +# [github] +# os_dependencies = "git libxml2 libxslt" +## + +## +# To test against a specific matrix of python versions +# when running tests jobs, add in .meta.toml: +# [github] +# py_versions = "['3.12', '3.11']" +## + + +## +# Specify additional jobs in .meta.toml: +# [github] +# extra_lines = """ +# another: +# uses: org/repo/.github/workflows/file.yml@main +# """ +## diff --git a/.gitignore b/.gitignore index 481d0ef..286487f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,40 +1,59 @@ -.coverage -.coverage.* +# Generated from: +# https://github.com/plone/meta/tree/main/config/default +# See the inline comments on how to expand/tweak this configuration file +# python related *.egg-info -*.log +*.pyc +*.pyo + +# translation related *.mo -*.py? -*.swp + +# tools related +build/ +.coverage .*project -# dirs -/.settings/ +coverage.xml +dist/ +docs/_build +__pycache__/ +.tox +.vscode/ +node_modules/ + +# venv / buildout related bin/ -buildout-cache/ develop-eggs/ eggs/ -htmlcov/ +.eggs/ +etc/ +.installed.cfg include/ lib/ -local/ -node_modules/ +lib64 +.mr.developer.cfg parts/ -dist/* -test.plone_addon/ +pyvenv.cfg var/ -# files -.installed.cfg -.mr.developer.cfg -coverage.xml -lib64 local.cfg -log.html -output.xml -pip-selfcheck.json -pyvenv.cfg -report.html -.vscode/ -.tox/ -reports/ -venv/ -# excludes + +# mxdev +/instance/ +/.make-sentinels/ +/*-mxdev.txt +/reports/ +/sources/ +/venv/ +.installed.txt + +forest.dot +forest.json .python-version + +## +# Add extra configuration options in .meta.toml: +# [gitignore] +# extra_lines = """ +# _your own configuration lines_ +# """ +## diff --git a/.meta.toml b/.meta.toml new file mode 100644 index 0000000..66b7fe5 --- /dev/null +++ b/.meta.toml @@ -0,0 +1,32 @@ +# Generated from: +# https://github.com/plone/meta/tree/main/config/default +# See the inline comments on how to expand/tweak this configuration file +[tox] +use_mxdev = true +config_lines = """ +[gh-actions] +python = + 3.8: py38 + 3.9: py39 + 3.10: py310 + 3.11: py311 + 3.12: py312 +""" + +[gitignore] +extra_lines = """ +forest.dot +forest.json +.python-version +""" + +[github] +jobs = [ + "qa", + "test", + "release_ready", + ] + +[meta] +template = "default" +commit-id = "721299ce" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..d60054b --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,94 @@ +# Generated from: +# https://github.com/plone/meta/tree/main/config/default +# See the inline comments on how to expand/tweak this configuration file +ci: + autofix_prs: false + autoupdate_schedule: monthly + +repos: +- repo: https://github.com/asottile/pyupgrade + rev: v3.15.2 + hooks: + - id: pyupgrade + args: [--py38-plus] +- repo: https://github.com/pycqa/isort + rev: 5.13.2 + hooks: + - id: isort +- repo: https://github.com/psf/black + rev: 24.4.2 + hooks: + - id: black +- repo: https://github.com/collective/zpretty + rev: 3.1.0 + hooks: + - id: zpretty + +## +# Add extra configuration options in .meta.toml: +# [pre_commit] +# zpretty_extra_lines = """ +# _your own configuration lines_ +# """ +## +- repo: https://github.com/PyCQA/flake8 + rev: 7.0.0 + hooks: + - id: flake8 + +## +# Add extra configuration options in .meta.toml: +# [pre_commit] +# flake8_extra_lines = """ +# _your own configuration lines_ +# """ +## +- repo: https://github.com/codespell-project/codespell + rev: v2.2.6 + hooks: + - id: codespell + additional_dependencies: + - tomli + +## +# Add extra configuration options in .meta.toml: +# [pre_commit] +# codespell_extra_lines = """ +# _your own configuration lines_ +# """ +## +- repo: https://github.com/mgedmin/check-manifest + rev: "0.49" + hooks: + - id: check-manifest +- repo: https://github.com/regebro/pyroma + rev: "4.2" + hooks: + - id: pyroma +- repo: https://github.com/mgedmin/check-python-versions + rev: "0.22.0" + hooks: + - id: check-python-versions + args: ['--only', 'setup.py,pyproject.toml'] +- repo: https://github.com/collective/i18ndude + rev: "6.2.0" + hooks: + - id: i18ndude + + +## +# Add extra configuration options in .meta.toml: +# [pre_commit] +# i18ndude_extra_lines = """ +# _your own configuration lines_ +# """ +## + + +## +# Add extra configuration options in .meta.toml: +# [pre_commit] +# extra_lines = """ +# _your own configuration lines_ +# """ +## diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 0bb2ac1..0000000 --- a/.travis.yml +++ /dev/null @@ -1,61 +0,0 @@ -dist: bionic -language: python -cache: - pip: true - directories: - - eggs - - $HOME/buildout-cache - - $HOME/.buildout -python: - - "2.7" -matrix: - include: - - python: "2.7" - env: PLONE_VERSION=43 - - python: "2.7" - env: PLONE_VERSION=51 - - python: "2.7" - env: PLONE_VERSION=52 - - python: "3.7" - env: PLONE_VERSION=52 - fast_finish: true - -before_install: - - mkdir -p $HOME/buildout-cache/{downloads,eggs,extends} - - mkdir -p $HOME/.buildout - - echo "[buildout]" > $HOME/.buildout/default.cfg - - echo "download-cache = $HOME/buildout-cache/downloads" >> $HOME/.buildout/default.cfg - - echo "eggs-directory = $HOME/buildout-cache/eggs" >> $HOME/.buildout/default.cfg - - echo "extends-cache = $HOME/buildout-cache/extends" >> $HOME/.buildout/default.cfg - - echo "abi-tag-eggs = true" >> $HOME/.buildout/default.cfg - - git config --global user.email "travis@travis-ci.org" - - git config --global user.name "Travis CI" - - sudo apt-get install -y firefox-geckodriver - - virtualenv -p `which python` . - - bin/pip install -r requirements.txt -c constraints_plone$PLONE_VERSION.txt - - cp test_plone$PLONE_VERSION.cfg buildout.cfg - -install: - - travis_retry pip install -U tox coveralls coverage -c constraints.txt - -before_script: - - 'export DISPLAY=:99.0' - - export VERBOSE=true - - Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & - - sleep 3 - -script: - - PYTEST_ADDOPTS="-s -vv" tox - -after_success: - - python -m coverage.pickle2json - - coverage combine - - coveralls - -notifications: - email: - recipients: -# - travis-reports@plone.com - - {author} - on_success: change - on_failure: change diff --git a/CHANGES.rst b/CHANGES.rst index 808eaad..2b40c05 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -2,8 +2,21 @@ Changelog ========= -1.0a1 (unreleased) ------------------- +1.0.0rc3 (unreleased) +--------------------- + +- Nothing changed yet. + + +1.0.0rc2 (2024-11-15) +--------------------- + +- Fix manifest + [mamico] + + +1.0.0rc1 (2024-11-13) +--------------------- - Initial release. [RedTurtle] diff --git a/MANIFEST.in b/MANIFEST.in index 9da61ef..6f28bf0 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,4 @@ -graft src/collective.formsupport +graft src/collective graft docs include *.rst exclude tox.ini diff --git a/base.cfg b/base.cfg index 3084a2b..45545a8 100644 --- a/base.cfg +++ b/base.cfg @@ -14,7 +14,7 @@ parts = releaser i18ndude omelette - robot +# robot plone-helper-scripts vscode diff --git a/dependabot.yml b/dependabot.yml new file mode 100644 index 0000000..bbd3ab0 --- /dev/null +++ b/dependabot.yml @@ -0,0 +1,11 @@ +# Generated from: +# https://github.com/plone/meta/tree/main/config/default +# See the inline comments on how to expand/tweak this configuration file +version: 2 +updates: + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + # Check for updates to GitHub Actions every week + interval: "weekly" diff --git a/mx.ini b/mx.ini new file mode 100644 index 0000000..bbb1d6c --- /dev/null +++ b/mx.ini @@ -0,0 +1,17 @@ +; This is a mxdev configuration file. +; it can be used to override versions of packages already defined in the +; constraints files and to add new packages from VCS like git. +; to learn more about mxdev visit https://pypi.org/project/mxdev/ + +[settings] +; example how to override a package version +; version-overrides = +; example.package==2.1.0a2 + +;version-overrides = + +[collective.volto.formsupport] +url = https://github.com/collective/collective.volto.formsupport.git +pushurl = git@github.com:collective/collective.volto.formsupport.git +extras = +branch = formaddevent diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..e0717ba --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,130 @@ +# Generated from: +# https://github.com/plone/meta/tree/main/config/default +# See the inline comments on how to expand/tweak this configuration file +[build-system] +requires = ["setuptools>=68.2"] + +## +# Add extra configuration options in .meta.toml: +# [pyproject] +# towncrier_extra_lines = """ +# extra_configuration +# """ +## + +[tool.isort] +profile = "plone" + +## +# Add extra configuration options in .meta.toml: +# [pyproject] +# isort_extra_lines = """ +# extra_configuration +# """ +## + +[tool.black] +target-version = ["py38"] + +## +# Add extra configuration options in .meta.toml: +# [pyproject] +# black_extra_lines = """ +# extra_configuration +# """ +## + +[tool.codespell] +ignore-words-list = "discreet," +skip = "*.po," +## +# Add extra configuration options in .meta.toml: +# [pyproject] +# codespell_ignores = "foo,bar" +# codespell_skip = "*.po,*.map,package-lock.json" +## + +[tool.dependencychecker] +Zope = [ + # Zope own provided namespaces + 'App', 'OFS', 'Products.Five', 'Products.OFSP', 'Products.PageTemplates', + 'Products.SiteAccess', 'Shared', 'Testing', 'ZPublisher', 'ZTUtils', + 'Zope2', 'webdav', 'zmi', + # ExtensionClass own provided namespaces + 'ExtensionClass', 'ComputedAttribute', 'MethodObject', + # Zope dependencies + 'AccessControl', 'Acquisition', 'AuthEncoding', 'beautifulsoup4', 'BTrees', + 'cffi', 'Chameleon', 'DateTime', 'DocumentTemplate', + 'MultiMapping', 'multipart', 'PasteDeploy', 'Persistence', 'persistent', + 'pycparser', 'python-gettext', 'pytz', 'RestrictedPython', 'roman', + 'soupsieve', 'transaction', 'waitress', 'WebOb', 'WebTest', 'WSGIProxy2', + 'z3c.pt', 'zc.lockfile', 'ZConfig', 'zExceptions', 'ZODB', 'zodbpickle', + 'zope.annotation', 'zope.browser', 'zope.browsermenu', 'zope.browserpage', + 'zope.browserresource', 'zope.cachedescriptors', 'zope.component', + 'zope.configuration', 'zope.container', 'zope.contentprovider', + 'zope.contenttype', 'zope.datetime', 'zope.deferredimport', + 'zope.deprecation', 'zope.dottedname', 'zope.event', 'zope.exceptions', + 'zope.filerepresentation', 'zope.globalrequest', 'zope.hookable', + 'zope.i18n', 'zope.i18nmessageid', 'zope.interface', 'zope.lifecycleevent', + 'zope.location', 'zope.pagetemplate', 'zope.processlifetime', 'zope.proxy', + 'zope.ptresource', 'zope.publisher', 'zope.schema', 'zope.security', + 'zope.sequencesort', 'zope.site', 'zope.size', 'zope.structuredtext', + 'zope.tal', 'zope.tales', 'zope.testbrowser', 'zope.testing', + 'zope.traversing', 'zope.viewlet' +] +'Products.CMFCore' = [ + 'docutils', 'five.localsitemanager', 'Missing', 'Products.BTreeFolder2', + 'Products.GenericSetup', 'Products.MailHost', 'Products.PythonScripts', + 'Products.StandardCacheManagers', 'Products.ZCatalog', 'Record', + 'zope.sendmail', 'Zope' +] +'plone.base' = [ + 'plone.batching', 'plone.registry', 'plone.schema','plone.z3cform', + 'Products.CMFCore', 'Products.CMFDynamicViewFTI', +] +python-dateutil = ['dateutil'] + +## +# Add extra configuration options in .meta.toml: +# [pyproject] +# dependencies_ignores = "['zestreleaser.towncrier']" +# dependencies_mappings = [ +# "gitpython = ['git']", +# "pygithub = ['github']", +# ] +## + +[tool.check-manifest] +ignore = [ + ".editorconfig", + ".flake8", + ".meta.toml", + ".pre-commit-config.yaml", + "dependabot.yml", + "mx.ini", + "tox.ini", + +] + +## +# Add extra configuration options in .meta.toml: +# [pyproject] +# check_manifest_ignores = """ +# "*.map.js", +# "*.pyc", +# """ +# check_manifest_extra_lines = """ +# ignore-bad-ideas = [ +# "some/test/file/PKG-INFO", +# ] +# """ +## + + +## +# Add extra configuration options in .meta.toml: +# [pyproject] +# extra_lines = """ +# _your own configuration lines_ +# """ +## diff --git a/setup.py b/setup.py index 9bd9f6a..b7af52e 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ setup( name="collective.formsupport.counter", - version="1.0a1", + version="1.0.0rc3.dev0", description="Counter integration for collective.volto.formsupport", long_description=long_description, # Get more from https://pypi.org/classifiers/ @@ -24,12 +24,12 @@ "Environment :: Web Environment", "Framework :: Plone", "Framework :: Plone :: Addon", - "Framework :: Plone :: 5.2", "Framework :: Plone :: 6.0", "Programming Language :: Python", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Operating System :: OS Independent", "License :: OSI Approved :: GNU General Public License v2 (GPLv2)", ], @@ -49,7 +49,7 @@ package_dir={"": "src"}, include_package_data=True, zip_safe=False, - python_requires=">=3.7", + python_requires=">=3.8", install_requires=[ "setuptools", # -*- Extra requirements: -*- @@ -66,7 +66,6 @@ # plone_coredev tests as of 2016-04-01. "plone.testing>=5.0.0", "plone.app.contenttypes", - "plone.app.robotframework[debug]", ], }, entry_points=""" diff --git a/src/collective/formsupport/counter/restapi/services/form_data/csv.py b/src/collective/formsupport/counter/restapi/services/form_data/csv.py index 7365d7d..d9fe534 100644 --- a/src/collective/formsupport/counter/restapi/services/form_data/csv.py +++ b/src/collective/formsupport/counter/restapi/services/form_data/csv.py @@ -11,7 +11,9 @@ class FormDataExportGetCounter(FormDataExportGet): def get_fields_labels(self, item): fields_labels = super().get_fields_labels(item) - fields_labels[COUNTER_BLOCKS_FIELD_ID] = translate(_("Form counter"), context=self.request) + fields_labels[COUNTER_BLOCKS_FIELD_ID] = translate( + _("Form counter"), context=self.request + ) return fields_labels def get_ordered_keys(self, record): diff --git a/src/collective/formsupport/counter/testing.py b/src/collective/formsupport/counter/testing.py index c99784e..beb0f2b 100644 --- a/src/collective/formsupport/counter/testing.py +++ b/src/collective/formsupport/counter/testing.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -from plone.app.robotframework.testing import REMOTE_LIBRARY_BUNDLE_FIXTURE from plone.app.testing import applyProfile from plone.app.testing import FunctionalTesting from plone.app.testing import IntegrationTesting @@ -43,13 +42,3 @@ def setUpPloneSite(self, portal): bases=(COLLECTIVE_FORMSUPPORT_COUNTER_FIXTURE,), name="CollectiveFormsupportCounterLayer:FunctionalTesting", ) - - -COLLECTIVE_FORMSUPPORT_COUNTER_ACCEPTANCE_TESTING = FunctionalTesting( - bases=( - COLLECTIVE_FORMSUPPORT_COUNTER_FIXTURE, - REMOTE_LIBRARY_BUNDLE_FIXTURE, - z2.ZSERVER_FIXTURE, - ), - name="CollectiveFormsupportCounterLayer:AcceptanceTesting", -) diff --git a/src/collective/formsupport/counter/tests/robot/test_example.robot b/src/collective/formsupport/counter/tests/robot/test_example.robot deleted file mode 100644 index 7f300d5..0000000 --- a/src/collective/formsupport/counter/tests/robot/test_example.robot +++ /dev/null @@ -1,66 +0,0 @@ -# ============================================================================ -# EXAMPLE ROBOT TESTS -# ============================================================================ -# -# Run this robot test stand-alone: -# -# $ bin/test -s collective.formsupport.counter -t test_example.robot --all -# -# Run this robot test with robot server (which is faster): -# -# 1) Start robot server: -# -# $ bin/robot-server --reload-path src collective.formsupport.counter.testing.COLLECTIVE_FORMSUPPORT_COUNTER_ACCEPTANCE_TESTING -# -# 2) Run robot tests: -# -# $ bin/robot src/collective/formsupport/counter/tests/robot/test_example.robot -# -# See the http://docs.plone.org for further details (search for robot -# framework). -# -# ============================================================================ - -*** Settings ***************************************************************** - -Resource plone/app/robotframework/selenium.robot -Resource plone/app/robotframework/keywords.robot - -Library Remote ${PLONE_URL}/RobotRemote - -Test Setup Open test browser -Test Teardown Close all browsers - - -*** Test Cases *************************************************************** - -Scenario: As a member I want to be able to log into the website - [Documentation] Example of a BDD-style (Behavior-driven development) test. - Given a login form - When I enter valid credentials - Then I am logged in - - -*** Keywords ***************************************************************** - -# --- Given ------------------------------------------------------------------ - -a login form - Go To ${PLONE_URL}/login_form - Wait until page contains Login Name - Wait until page contains Password - - -# --- WHEN ------------------------------------------------------------------- - -I enter valid credentials - Input Text __ac_name admin - Input Text __ac_password secret - Click Button Log in - - -# --- THEN ------------------------------------------------------------------- - -I am logged in - Wait until page contains You are now logged in - Page should contain You are now logged in diff --git a/src/collective/formsupport/counter/tests/test_robot.py b/src/collective/formsupport/counter/tests/test_robot.py deleted file mode 100644 index ec16755..0000000 --- a/src/collective/formsupport/counter/tests/test_robot.py +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8 -*- -from collective.formsupport.counter.testing import ( # noqa: E501 - COLLECTIVE_FORMSUPPORT_COUNTER_ACCEPTANCE_TESTING, -) -from plone.app.testing import ROBOT_TEST_LEVEL -from plone.testing import layered - -import os -import robotsuite -import unittest - - -def test_suite(): - suite = unittest.TestSuite() - current_dir = os.path.abspath(os.path.dirname(__file__)) - robot_dir = os.path.join(current_dir, "robot") - robot_tests = [ - os.path.join("robot", doc) - for doc in os.listdir(robot_dir) - if doc.endswith(".robot") and doc.startswith("test_") - ] - for robot_test in robot_tests: - robottestsuite = robotsuite.RobotTestSuite(robot_test) - robottestsuite.level = ROBOT_TEST_LEVEL - suite.addTests( - [ - layered( - robottestsuite, - layer=COLLECTIVE_FORMSUPPORT_COUNTER_ACCEPTANCE_TESTING, - ), - ] - ) - return suite diff --git a/tox.ini b/tox.ini index 34f5cd8..efd3c89 100644 --- a/tox.ini +++ b/tox.ini @@ -1,199 +1,227 @@ +# Generated from: +# https://github.com/plone/meta/tree/main/config/default +# See the inline comments on how to expand/tweak this configuration file [tox] - -min_version = 4.11.0 - +# We need 4.4.0 for constrain_package_deps. +min_version = 4.4.0 envlist = -# py37-lint, -# py38-lint, -# py39-lint, -# py310-lint, - py311-lint, - black-check, -# py{38,37}-Plone{52}, -# py{39,310}-Plone{60}, - py{311}-Plone{60}, -# docs, -# coverage-report, - -skip_missing_interpreters = True - + lint + test + dependencies [gh-actions] python = - 3.6: py36 - 3.7: py37 3.8: py38 3.9: py39 3.10: py310 3.11: py311 - - -[gh-actions:env] -PLONE-VERSION = - Plone52: Plone52 - Plone60: Plone60 - + 3.12: py312 + +## +# Add extra configuration options in .meta.toml: +# [tox] +# envlist_lines = """ +# my_other_environment +# """ +# config_lines = """ +# my_extra_top_level_tox_configuration_lines +# """ +## [testenv] skip_install = true - -extras = - develop - test - +allowlist_externals = + echo + false +# Make sure typos like `tox -e formaat` are caught instead of silently doing nothing. +# See https://github.com/tox-dev/tox/issues/2858. commands = -# {envbindir}/buildout -q -c {toxinidir}/{env:version_file} buildout:directory={envdir} buildout:develop={toxinidir} bootstrap -# {envbindir}/buildout -c {toxinidir}/{env:version_file} buildout:directory={envdir} buildout:develop={toxinidir} annotate - {envbindir}/buildout -n -qq -c {toxinidir}/{env:version_file} buildout:directory={envdir} buildout:develop={toxinidir} install test robot - coverage run {envbindir}/test -v1 --auto-color {posargs} - # coverage run {envbindir}/test -v --all -t robot {posargs} - -setenv = - COVERAGE_FILE=.coverage.{envname} - # version_file=test_plone60.cfg - Plone52: version_file=test_plone52.cfg - Plone60: version_file=test_plone60.cfg - + echo "Unrecognized environment name {envname}" + false + +## +# Add extra configuration options in .meta.toml: +# [tox] +# testenv_options = """ +# basepython = /usr/bin/python3.8 +# """ +## + +[testenv:init] +description = Prepare environment +skip_install = true deps = - Plone52: -rrequirements_plone52.txt -# Plone52: -cconstraints_plone52.txt - Plone60: -rrequirements_plone60.txt -# Plone60: -cconstraints_plone60.txt - coverage + mxdev +commands = + mxdev -c mx.ini + echo "Initial setup for mxdev" -[testenv:coverage-report] +[testenv:format] +description = automatically reformat code skip_install = true -usedevelop = True -basepython = python3.11 - deps = - coverage - -cconstraints_plone60.txt - -setenv = - COVERAGE_FILE=.coverage - + pre-commit commands = - coverage erase - coverage combine - coverage html - coverage xml - coverage report - + pre-commit run -a pyupgrade + pre-commit run -a isort + pre-commit run -a black + pre-commit run -a zpretty [testenv:lint] +description = run linters that will help improve the code style skip_install = true - deps = - -cconstraints.txt - isort - flake8 - # helper to generate HTML reports: - # flake8-html>=0.4.3 - # Useful flake8 plugins that are Python and Plone specific: - ; flake8-coding - flake8-debugger - flake8-deprecated - flake8-print - #flake8-pytest - flake8-todo - mccabe - # Potential flake8 plugins that should be used: # TBD - #flake8-blind-except - #flake8-commas - #flake8-docstrings - #flake8-mypy - #flake8-pep3101 - #flake8-plone-hasattr - #flake8-string-format - #flake8_strict - #flake8-quotes - #flake8-polyfill - + pre-commit commands = - mkdir -p {toxinidir}/reports/flake8 - flake8 --doctests {toxinidir}/src {toxinidir}/setup.py - isort --check-only {toxinidir}/src {toxinidir}/setup.py - # black --check --diff -v {toxinidir}/src {toxinidir}/setup.py - -allowlist_externals = - mkdir - + pre-commit run -a -[testenv:isort-apply] +[testenv:dependencies] +description = check if the package defines all its dependencies skip_install = true - deps = - -cconstraints.txt - isort - + build + z3c.dependencychecker==2.14.3 commands = - isort {toxinidir}/src {toxinidir}/setup.py + python -m build --sdist + dependencychecker - -[testenv:black-check] -basepython = python3.11 -skip_install = True +[testenv:dependencies-graph] +description = generate a graph out of the dependencies of the package +skip_install = false +allowlist_externals = + sh deps = - -cconstraints.txt - black - + pipdeptree==2.5.1 + graphviz # optional dependency of pipdeptree commands = - black --check --diff -v src setup.py - - -[testenv:black-enforce] -basepython = python3.11 -skip_install = True + sh -c 'pipdeptree --exclude setuptools,wheel,pipdeptree,zope.interface,zope.component --graph-output svg > dependencies.svg' + +[testenv:test] +description = run the distribution tests +use_develop = true +skip_install = false +constrain_package_deps = false +set_env = + ROBOT_BROWSER=headlesschrome + +## +# Specify extra test environment variables in .meta.toml: +# [tox] +# test_environment_variables = """ +# PIP_EXTRA_INDEX_URL=https://my-pypi.my-server.com/ +# """ +# +# Set constrain_package_deps .meta.toml: +# [tox] +# constrain_package_deps = "false" +## deps = - -cconstraints.txt - black - + zope.testrunner + -c constraints-mxdev.txt + +## +# Specify additional deps in .meta.toml: +# [tox] +# test_deps_additional = "-esources/plonegovbr.portal_base[test]" +# +# Specify a custom constraints file in .meta.toml: +# [tox] +# constraints_file = "https://my-server.com/constraints.txt" +## commands = - black -v src setup.py - - -[testenv:py37-lint] -basepython = python3.7 -skip_install = true -deps = {[lint]deps} -commands = {[lint]commands} -allowlist_externals = {[lint]allowlist_externals} - -[testenv:py38-lint] -basepython = python3.8 -skip_install = true -deps = {[lint]deps} -commands = {[lint]commands} -allowlist_externals = {[lint]allowlist_externals} + # rfbrowser init + zope-testrunner --all --test-path={toxinidir}/src -s collective.formsupport.counter {posargs} +extras = + test -[testenv:py39-lint] -basepython = python3.9 -skip_install = true -deps = {[lint]deps} -commands = {[lint]commands} -allowlist_externals = {[lint]allowlist_externals} +## +# Add extra configuration options in .meta.toml: +# [tox] +# test_extras = """ +# tests +# widgets +# """ +## + +[testenv:coverage] +description = get a test coverage report +use_develop = true +skip_install = false +constrain_package_deps = false +# set_env = +# ROBOT_BROWSER=headlesschrome + +## +# Specify extra test environment variables in .meta.toml: +# [tox] +# test_environment_variables = """ +# PIP_EXTRA_INDEX_URL=https://my-pypi.my-server.com/ +# """ +## +deps = + coverage + zope.testrunner + -c constraints-mxdev.txt -[testenv:py310-lint] -basepython = python3.10 -skip_install = true -deps = {[lint]deps} -commands = {[lint]commands} -allowlist_externals = {[lint]allowlist_externals} +commands = + rfbrowser init + coverage run --branch --source collective.formsupport.counter {envbindir}/zope-testrunner --quiet --all --test-path={toxinidir}/src -s collective.formsupport.counter {posargs} + coverage report -m --format markdown + coverage xml + coverage html +extras = + test -[testenv:py311-lint] -basepython = python3.11 -skip_install = true -deps = {[lint]deps} -commands = {[lint]commands} -allowlist_externals = {[lint]allowlist_externals} -[testenv:docs] +[testenv:release-check] +description = ensure that the distribution is ready to release skip_install = true +deps = + twine + build + -c constraints-mxdev.txt +commands = + python -m build --sdist + twine check dist/* + +[testenv:circular] +description = ensure there are no cyclic dependencies +use_develop = true +skip_install = false +# Here we must always constrain the package deps to what is already installed, +# otherwise we simply get the latest from PyPI, which may not work. +constrain_package_deps = true +set_env = + +## +# Specify extra test environment variables in .meta.toml: +# [tox] +# test_environment_variables = """ +# PIP_EXTRA_INDEX_URL=https://my-pypi.my-server.com/ +# """ +## +allowlist_externals = + sh deps = - Sphinx + pipdeptree + pipforester + -c constraints-mxdev.txt commands = - sphinx-build -b html -d _build/docs/doctrees docs _build/docs/html + # Generate the full dependency tree + sh -c 'pipdeptree -j > forest.json' + # Generate a DOT graph with the circular dependencies, if any + pipforester -i forest.json -o forest.dot --cycles + # Report if there are any circular dependencies, i.e. error if there are any + pipforester -i forest.json --check-cycles -o /dev/null + + +## +# Add extra configuration options in .meta.toml: +# [tox] +# extra_lines = """ +# _your own configuration lines_ +# """ +##