diff --git a/.editorconfig b/.editorconfig index 8ae05aa..55bfb6d 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,5 +1,5 @@ # Generated from: -# https://github.com/plone/meta/tree/master/config/default +# https://github.com/plone/meta/tree/2.x/src/plone/meta/default # See the inline comments on how to expand/tweak this configuration file # # EditorConfig Configuration file, for more details see: @@ -13,7 +13,8 @@ root = true -[*] # For All Files +[*] +# Default settings for all files. # Unix-style newlines with a newline ending every file end_of_line = lf insert_final_newline = true @@ -29,11 +30,12 @@ max_line_length = off # 4 space indentation indent_size = 4 -[*.{yml,zpt,pt,dtml,zcml}] +[*.{yml,zpt,pt,dtml,zcml,html,xml}] # 2 space indentation indent_size = 2 -[*.{json,jsonl,js,jsx,ts,tsx,css,less,scss,html}] # Frontend development +[*.{json,jsonl,js,jsx,ts,tsx,css,less,scss}] +# Frontend development # 2 space indentation indent_size = 2 max_line_length = 80 diff --git a/.flake8 b/.flake8 index 7ef4f64..ff17672 100644 --- a/.flake8 +++ b/.flake8 @@ -1,5 +1,5 @@ # Generated from: -# https://github.com/plone/meta/tree/master/config/default +# https://github.com/plone/meta/tree/2.x/src/plone/meta/default # See the inline comments on how to expand/tweak this configuration file [flake8] doctests = 1 diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..676b588 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,13 @@ +# Generated from: +# https://github.com/plone/meta/tree/2.x/src/plone/meta/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" + cooldown: + default-days: 7 diff --git a/.github/workflows/meta.yml b/.github/workflows/meta.yml index 83870ef..542be81 100644 --- a/.github/workflows/meta.yml +++ b/.github/workflows/meta.yml @@ -1,19 +1,11 @@ # Generated from: -# https://github.com/plone/meta/tree/main/config/default +# https://github.com/plone/meta/tree/2.x/src/plone/meta/default # See the inline comments on how to expand/tweak this configuration file name: Meta -permissions: - contents: read - pull-requests: write +permissions: {} + on: push: - branches: - - master - - main - pull_request: - branches: - - master - - main workflow_dispatch: ## @@ -28,24 +20,21 @@ on: jobs: qa: - uses: plone/meta/.github/workflows/qa.yml@main -# test: -# uses: plone/meta/.github/workflows/test.yml@main -# with: -# py-versions: '["3.12", "3.11", "3.10"]' -# coverage: -# uses: plone/meta/.github/workflows/coverage.yml@main -# dependencies: -# uses: plone/meta/.github/workflows/dependencies.yml@main + uses: plone/meta/.github/workflows/qa.yml@2.x + coverage: + uses: plone/meta/.github/workflows/coverage.yml@2.x + with: + os-packages: 'libldap2-dev libsasl2-dev' + dependencies: + uses: plone/meta/.github/workflows/dependencies.yml@2.x release_ready: - uses: plone/meta/.github/workflows/release_ready.yml@main + uses: plone/meta/.github/workflows/release_ready.yml@2.x ## # To modify the list of default jobs being created add in .meta.toml: # [github] # jobs = [ # "qa", -# "test", # "coverage", # "dependencies", # "release_ready", @@ -60,13 +49,6 @@ jobs: # 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: diff --git a/.gitignore b/.gitignore index 6a1e51f..5b8ff61 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,18 @@ # Generated from: -# https://github.com/plone/meta/tree/master/config/default +# https://github.com/plone/meta/tree/2.x/src/plone/meta/default # See the inline comments on how to expand/tweak this configuration file # python related *.egg-info *.pyc *.pyo +# translation related +*.mo + # tools related build/ .coverage +.*project coverage.xml dist/ docs/_build @@ -16,6 +20,8 @@ __pycache__/ .tox .vscode/ node_modules/ +forest.dot +forest.json # venv / buildout related bin/ @@ -31,6 +37,7 @@ lib64 parts/ pyvenv.cfg var/ +local.cfg # mxdev /instance/ @@ -40,7 +47,10 @@ var/ /sources/ /venv/ .installed.txt + .lock +.python-version +.venv/ ## # Add extra configuration options in .meta.toml: diff --git a/.meta.toml b/.meta.toml index 6558f60..72f1914 100644 --- a/.meta.toml +++ b/.meta.toml @@ -1,34 +1,34 @@ # Generated from: -# https://github.com/plone/meta/tree/main/config/default +# https://github.com/plone/meta/tree/2.x/src/plone/meta/default # See the inline comments on how to expand/tweak this configuration file [meta] template = "default" -commit-id = "71d0218b" +commit-id = "2.11.0" [pyproject] codespell_skip = "*.min.js,*.ldif" codespell_ignores = "vew" -dependencies_mappings = [ - "pytest-plone = ['pytest', 'plone.testing', 'plone.app.testing']", -] -dependencies_ignores = "['plone.app.iterate', 'plone.app.upgrade', 'plone.volto', 'zestreleaser.towncrier', 'zest.releaser', 'pytest-cov']" +dependencies_ignores = "['plone.app.iterate', 'plone.app.upgrade', 'plone.volto', 'zestreleaser.towncrier', 'zest.releaser', 'zest.pocompile', 'pytest', 'pytest-cov', 'setuptools']" [gitignore] extra_lines = """ .lock +.python-version +.venv/ """ [tox] test_runner = "pytest" test_path = "/tests" use_mxdev = true +use_test_matrix = false test_deps_additional = "" [github] +os_dependencies = "libldap2-dev libsasl2-dev" py_versions = "[\"3.12\", \"3.11\", \"3.10\"]" jobs = [ "qa", - "test", "coverage", "dependencies", "release_ready", diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b6eb043..27bcf0c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,5 +1,5 @@ # Generated from: -# https://github.com/plone/meta/tree/master/config/default +# https://github.com/plone/meta/tree/2.x/src/plone/meta/default # See the inline comments on how to expand/tweak this configuration file ci: autofix_prs: false @@ -7,20 +7,20 @@ ci: repos: - repo: https://github.com/asottile/pyupgrade - rev: v3.14.0 + rev: v3.21.2 hooks: - id: pyupgrade - args: [--py38-plus] + args: [--py39-plus] - repo: https://github.com/pycqa/isort - rev: 5.12.0 + rev: 9.0.0b1 hooks: - id: isort -- repo: https://github.com/psf/black - rev: 23.9.1 +- repo: https://github.com/psf/black-pre-commit-mirror + rev: 26.5.1 hooks: - id: black - repo: https://github.com/collective/zpretty - rev: 3.1.0 + rev: 4.0.3 hooks: - id: zpretty @@ -32,7 +32,7 @@ repos: # """ ## - repo: https://github.com/PyCQA/flake8 - rev: 6.1.0 + rev: 7.3.0 hooks: - id: flake8 @@ -44,7 +44,7 @@ repos: # """ ## - repo: https://github.com/codespell-project/codespell - rev: v2.2.6 + rev: v2.4.3 hooks: - id: codespell additional_dependencies: @@ -58,20 +58,20 @@ repos: # """ ## - repo: https://github.com/mgedmin/check-manifest - rev: "0.49" + rev: "0.51" hooks: - id: check-manifest - repo: https://github.com/regebro/pyroma - rev: "4.2" + rev: "5.1b1" hooks: - id: pyroma - repo: https://github.com/mgedmin/check-python-versions - rev: "0.21.3" + rev: "0.24.2" hooks: - id: check-python-versions - args: ['--only', 'setup.py,pyproject.toml'] + args: ['--only', 'setup.py'] - repo: https://github.com/collective/i18ndude - rev: "6.1.0" + rev: "6.3.0" hooks: - id: i18ndude diff --git a/news/+dependencies.bugfix b/news/+dependencies.bugfix new file mode 100644 index 0000000..bea7e4f --- /dev/null +++ b/news/+dependencies.bugfix @@ -0,0 +1 @@ +Declare all directly imported dependencies explicitly and drop unused ones (``collective.regenv``, ``yafowil.plone``, ``yafowil.bootstrap``, ``plone.restapi``) @mamico diff --git a/news/+meta.internal b/news/+meta.internal new file mode 100644 index 0000000..1336cd3 --- /dev/null +++ b/news/+meta.internal @@ -0,0 +1 @@ +Update configuration files @plone diff --git a/news/+remove-profiles.breaking b/news/+remove-profiles.breaking new file mode 100644 index 0000000..f8ed8da --- /dev/null +++ b/news/+remove-profiles.breaking @@ -0,0 +1 @@ +Remove the unused GenericSetup install/uninstall profile scaffolding (it was never wired into ``configure.zcml``, so the addon was never actually installable through it) and the corresponding installation tests @mamico diff --git a/news/.changelog_template.jinja b/news/.changelog_template.jinja index 678bfa1..b35bff3 100644 --- a/news/.changelog_template.jinja +++ b/news/.changelog_template.jinja @@ -1,9 +1,9 @@ -{% if sections[] %} -{% for category, val in definitions.items() if category in sections[] %} +{% if sections[""] %} +{% for category, val in definitions.items() if category in sections[""] %} ### {{ definitions[category]['name'] }} -{% for text, values in sections[][category].items() %} +{% for text, values in sections[""][category].items() %} - {{ text }} {{ values|join(', ') }} {% endfor %} @@ -12,4 +12,4 @@ No significant changes. -{% endif %} +{% endif %} \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index e8af3b7..7155b7f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,10 @@ # Generated from: -# https://github.com/plone/meta/tree/main/config/default +# https://github.com/plone/meta/tree/2.x/src/plone/meta/default # See the inline comments on how to expand/tweak this configuration file [build-system] -requires = ["setuptools>=75.1"] +requires = ["setuptools>=68.2,<82", "wheel"] + + [tool.towncrier] directory = "news/" @@ -14,27 +16,27 @@ underlines = ["", "", ""] [[tool.towncrier.type]] directory = "breaking" -name = "Breaking changes:" +name = "Breaking changes" showcontent = true [[tool.towncrier.type]] directory = "feature" -name = "New features:" +name = "New features" showcontent = true [[tool.towncrier.type]] directory = "bugfix" -name = "Bug fixes:" +name = "Bug fixes" showcontent = true [[tool.towncrier.type]] directory = "internal" -name = "Internal:" +name = "Internal" showcontent = true [[tool.towncrier.type]] directory = "documentation" -name = "Documentation:" +name = "Documentation" showcontent = true [[tool.towncrier.type]] @@ -62,7 +64,7 @@ profile = "plone" ## [tool.black] -target-version = ["py38"] +target-version = ["py39"] ## # Add extra configuration options in .meta.toml: @@ -73,7 +75,7 @@ target-version = ["py38"] ## [tool.codespell] -ignore-words-list = "discreet,vew" +ignore-words-list = "discreet,assertin,thet,vew" skip = "*.po,*.min.js,*.ldif" ## # Add extra configuration options in .meta.toml: @@ -121,8 +123,8 @@ Zope = [ 'Products.CMFCore', 'Products.CMFDynamicViewFTI', ] python-dateutil = ['dateutil'] -pytest-plone = ['pytest', 'plone.testing', 'plone.app.testing'] -ignore-packages = ['plone.app.iterate', 'plone.app.upgrade', 'plone.volto', 'zestreleaser.towncrier', 'zest.releaser', 'pytest-cov'] +pytest-plone = ['pytest', 'zope.pytestlayer', 'plone.testing', 'plone.app.testing'] +ignore-packages = ['plone.app.iterate', 'plone.app.upgrade', 'plone.volto', 'zestreleaser.towncrier', 'zest.releaser', 'zest.pocompile', 'pytest', 'pytest-cov', 'setuptools'] ## # Add extra configuration options in .meta.toml: diff --git a/scripts/create_site.py b/scripts/create_site.py index a5fac7a..5d5bb61 100644 --- a/scripts/create_site.py +++ b/scripts/create_site.py @@ -10,7 +10,6 @@ import os import transaction - truthy = frozenset(("t", "true", "y", "yes", "on", "1")) diff --git a/setup.py b/setup.py index 6b1f758..bc5fff8 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,6 @@ from setuptools import find_packages from setuptools import setup - long_description = f""" {Path("README.md").read_text()}\n {Path("CONTRIBUTORS.md").read_text()}\n @@ -51,19 +50,26 @@ python_requires=">=3.8", install_requires=[ "setuptools", + "Products.CMFCore", "Products.CMFPlone", + "Products.PlonePAS", + "Products.PluggableAuthService", + "persistent", "plone.api", - "collective.regenv", + "plone.protect", + "zope.globalrequest", + "zope.i18nmessageid", + "zope.processlifetime", + "zope.publisher", "pas.plugins.ldap>=1.8.0", - "yafowil.plone>=5.0.0a1", - "yafowil.bootstrap>=2.0.0a1", ], extras_require={ "test": [ "zest.releaser[recommended]", "zestreleaser.towncrier", + "plone.app.contenttypes", + "plone.app.robotframework", "plone.app.testing", - "plone.restapi[test]", "pytest", "pytest-cov", "pytest-plone>=0.5.0", diff --git a/src/redturtle/pasldap/__init__.py b/src/redturtle/pasldap/__init__.py index c236236..b187b7d 100644 --- a/src/redturtle/pasldap/__init__.py +++ b/src/redturtle/pasldap/__init__.py @@ -7,7 +7,6 @@ import logging import os - PACKAGE_NAME = "redturtle.pasldap" _ = MessageFactory(PACKAGE_NAME) diff --git a/src/redturtle/pasldap/configure.zcml b/src/redturtle/pasldap/configure.zcml index 24e217c..ac9efc3 100644 --- a/src/redturtle/pasldap/configure.zcml +++ b/src/redturtle/pasldap/configure.zcml @@ -11,7 +11,6 @@ - diff --git a/src/redturtle/pasldap/metrics.py b/src/redturtle/pasldap/metrics.py index cfcc2f9..3f94372 100644 --- a/src/redturtle/pasldap/metrics.py +++ b/src/redturtle/pasldap/metrics.py @@ -9,11 +9,11 @@ def emoji_by_elapsed(elapsed): if elapsed < 20: - return "\U0001F60E" # GOOD + return "\U0001f60e" # GOOD elif elapsed < 100: - return "\U0001F914" # MUMBLE + return "\U0001f914" # MUMBLE else: - return "\U0001F4A9" # SHIT + return "\U0001f4a9" # SHIT def sanitize_kwargs(kwargs): diff --git a/src/redturtle/pasldap/profiles.zcml b/src/redturtle/pasldap/profiles.zcml deleted file mode 100644 index 21faf0e..0000000 --- a/src/redturtle/pasldap/profiles.zcml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - diff --git a/src/redturtle/pasldap/profiles/default/browserlayer.xml b/src/redturtle/pasldap/profiles/default/browserlayer.xml deleted file mode 100644 index 1c168cf..0000000 --- a/src/redturtle/pasldap/profiles/default/browserlayer.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - diff --git a/src/redturtle/pasldap/profiles/default/catalog.xml b/src/redturtle/pasldap/profiles/default/catalog.xml deleted file mode 100644 index 9558132..0000000 --- a/src/redturtle/pasldap/profiles/default/catalog.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - diff --git a/src/redturtle/pasldap/profiles/default/controlpanel.xml b/src/redturtle/pasldap/profiles/default/controlpanel.xml deleted file mode 100644 index 75eae58..0000000 --- a/src/redturtle/pasldap/profiles/default/controlpanel.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/src/redturtle/pasldap/profiles/default/diff_tool.xml b/src/redturtle/pasldap/profiles/default/diff_tool.xml deleted file mode 100644 index 6a1c5f4..0000000 --- a/src/redturtle/pasldap/profiles/default/diff_tool.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/src/redturtle/pasldap/profiles/default/metadata.xml b/src/redturtle/pasldap/profiles/default/metadata.xml deleted file mode 100644 index c8c3aca..0000000 --- a/src/redturtle/pasldap/profiles/default/metadata.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - 1000 - - - diff --git a/src/redturtle/pasldap/profiles/default/registry/main.xml b/src/redturtle/pasldap/profiles/default/registry/main.xml deleted file mode 100644 index bc69b04..0000000 --- a/src/redturtle/pasldap/profiles/default/registry/main.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - diff --git a/src/redturtle/pasldap/profiles/default/repositorytool.xml b/src/redturtle/pasldap/profiles/default/repositorytool.xml deleted file mode 100644 index 4f674d6..0000000 --- a/src/redturtle/pasldap/profiles/default/repositorytool.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/src/redturtle/pasldap/profiles/default/rolemap.xml b/src/redturtle/pasldap/profiles/default/rolemap.xml deleted file mode 100644 index a803517..0000000 --- a/src/redturtle/pasldap/profiles/default/rolemap.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/src/redturtle/pasldap/profiles/default/theme.xml b/src/redturtle/pasldap/profiles/default/theme.xml deleted file mode 100644 index 7f916aa..0000000 --- a/src/redturtle/pasldap/profiles/default/theme.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - barceloneta - true - diff --git a/src/redturtle/pasldap/profiles/default/types.xml b/src/redturtle/pasldap/profiles/default/types.xml deleted file mode 100644 index bed2b0d..0000000 --- a/src/redturtle/pasldap/profiles/default/types.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - diff --git a/src/redturtle/pasldap/profiles/default/types/.gitkeep b/src/redturtle/pasldap/profiles/default/types/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/src/redturtle/pasldap/profiles/uninstall/browserlayer.xml b/src/redturtle/pasldap/profiles/uninstall/browserlayer.xml deleted file mode 100644 index 9aeab91..0000000 --- a/src/redturtle/pasldap/profiles/uninstall/browserlayer.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - diff --git a/src/redturtle/pasldap/resilient.py b/src/redturtle/pasldap/resilient.py index 49a6410..7394dad 100644 --- a/src/redturtle/pasldap/resilient.py +++ b/src/redturtle/pasldap/resilient.py @@ -5,7 +5,6 @@ from redturtle.pasldap import ldap_readonly from redturtle.pasldap import logger - # potential users in the Zope acl_users RESERVED_IDS = [ "root", diff --git a/src/redturtle/pasldap/setuphandlers/__init__.py b/src/redturtle/pasldap/setuphandlers/__init__.py deleted file mode 100644 index e5015f0..0000000 --- a/src/redturtle/pasldap/setuphandlers/__init__.py +++ /dev/null @@ -1,11 +0,0 @@ -from Products.CMFPlone.interfaces import INonInstallable -from zope.interface import implementer - - -@implementer(INonInstallable) -class HiddenProfiles: - def getNonInstallableProfiles(self): - """Hide uninstall profile from site-creation and quickinstaller.""" - return [ - "redturtle.pasldap:uninstall", - ] diff --git a/src/redturtle/pasldap/subscribers/startup.py b/src/redturtle/pasldap/subscribers/startup.py index 1dd1cbb..98eef3e 100644 --- a/src/redturtle/pasldap/subscribers/startup.py +++ b/src/redturtle/pasldap/subscribers/startup.py @@ -7,7 +7,6 @@ import logging - logger = logging.getLogger(__name__) diff --git a/src/redturtle/pasldap/testing.py b/src/redturtle/pasldap/testing.py index df3654b..2d1e52e 100644 --- a/src/redturtle/pasldap/testing.py +++ b/src/redturtle/pasldap/testing.py @@ -1,6 +1,5 @@ from plone.app.contenttypes.testing import PLONE_APP_CONTENTTYPES_FIXTURE 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 from plone.app.testing import PloneSandboxLayer @@ -18,9 +17,6 @@ def setUpZope(self, app, configurationContext): # layer. self.loadZCML(package=redturtle.pasldap) - def setUpPloneSite(self, portal): - applyProfile(portal, "redturtle.pasldap:default") - FIXTURE = Layer() diff --git a/src/redturtle/pasldap/upgrades/__init__.py b/src/redturtle/pasldap/upgrades/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/redturtle/pasldap/upgrades/configure.zcml b/src/redturtle/pasldap/upgrades/configure.zcml deleted file mode 100644 index f51f825..0000000 --- a/src/redturtle/pasldap/upgrades/configure.zcml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - diff --git a/tests/conftest.py b/tests/conftest.py index 4923a7b..59c8c46 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -3,10 +3,17 @@ from redturtle.pasldap.testing import FUNCTIONAL_TESTING from redturtle.pasldap.testing import INTEGRATION_TESTING +import pytest pytest_plugins = ["pytest_plone"] +def pytest_sessionfinish(session, exitstatus): + # There is no test suite yet: don't fail CI because of that. + if exitstatus == pytest.ExitCode.NO_TESTS_COLLECTED: + session.exitstatus = pytest.ExitCode.OK + + globals().update( fixtures_factory( ( diff --git a/tests/setup/test_setup_install.py b/tests/setup/test_setup_install.py deleted file mode 100644 index b4427e0..0000000 --- a/tests/setup/test_setup_install.py +++ /dev/null @@ -1,17 +0,0 @@ -from redturtle.pasldap import PACKAGE_NAME - - -class TestSetupInstall: - def test_addon_installed(self, installer): - """Test if redturtle.pasldap is installed.""" - assert installer.is_product_installed(PACKAGE_NAME) is True - - def test_browserlayer(self, browser_layers): - """Test that IBrowserLayer is registered.""" - from redturtle.pasldap.interfaces import IBrowserLayer - - assert IBrowserLayer in browser_layers - - def test_latest_version(self, profile_last_version): - """Test latest version of default profile.""" - assert profile_last_version(f"{PACKAGE_NAME}:default") == "1000" diff --git a/tests/setup/test_setup_uninstall.py b/tests/setup/test_setup_uninstall.py deleted file mode 100644 index c08704b..0000000 --- a/tests/setup/test_setup_uninstall.py +++ /dev/null @@ -1,19 +0,0 @@ -from redturtle.pasldap import PACKAGE_NAME - -import pytest - - -class TestSetupUninstall: - @pytest.fixture(autouse=True) - def uninstalled(self, installer): - installer.uninstall_product(PACKAGE_NAME) - - def test_addon_uninstalled(self, installer): - """Test if redturtle.pasldap is uninstalled.""" - assert installer.is_product_installed(PACKAGE_NAME) is False - - def test_browserlayer_not_registered(self, browser_layers): - """Test that IBrowserLayer is not registered.""" - from redturtle.pasldap.interfaces import IBrowserLayer - - assert IBrowserLayer not in browser_layers diff --git a/tox.ini b/tox.ini index 05f8004..afd1f7f 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ # Generated from: -# https://github.com/plone/meta/tree/master/config/default +# https://github.com/plone/meta/tree/2.x/src/plone/meta/default # See the inline comments on how to expand/tweak this configuration file [tox] # We need 4.4.0 for constrain_package_deps. @@ -7,12 +7,19 @@ min_version = 4.4.0 envlist = lint test + dependencies ## # Add extra configuration options in .meta.toml: +# - to specify a custom testing combination of Plone and python versions, use `test_matrix` +# Use ["*"] to use all supported Python versions for this Plone version. +# - to disable the test matrix entirely, set `use_test_matrix = false` +# - to specify extra custom environments, use `envlist_lines` +# - to specify extra `tox` top-level options, use `config_lines` # [tox] +# test_matrix = {"6.2" = ["3.13", "3.12"], "6.1" = ["*"]} # envlist_lines = """ # my_other_environment # """ @@ -21,27 +28,17 @@ envlist = # """ ## -[testenv] -skip_install = true -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 = - echo "Unrecognized environment name {envname}" - false - [testenv:init] description = Prepare environment skip_install = true +allowlist_externals = + echo deps = mxdev commands = mxdev -c mx.ini echo "Initial setup for mxdev" - [testenv:format] description = automatically reformat code skip_install = true @@ -59,17 +56,16 @@ skip_install = true deps = pre-commit commands = - # Run pre-commit without chdir to the root of the git repository - python -c "from pre_commit import main; main._adjust_args_and_chdir = lambda args: None; raise SystemExit(main.main())" run -a + pre-commit run -a [testenv:dependencies] description = check if the package defines all its dependencies skip_install = true deps = build - z3c.dependencychecker==2.11 + z3c.dependencychecker==3.0 commands = - python -m build --sdist --no-isolation + python -m build --wheel dependencychecker [testenv:dependencies-graph] @@ -83,8 +79,23 @@ deps = commands = sh -c 'pipdeptree --exclude setuptools,wheel,pipdeptree,zope.interface,zope.component --graph-output svg > dependencies.svg' -[testenv:test] -description = run the distribution tests + +[test_runner] +deps = + pytest + pytest-plone +test = + rfbrowser init + pytest --disable-warnings {posargs} {toxinidir}/tests +coverage = + rfbrowser init + coverage run --source redturtle.pasldap -m pytest {posargs} --disable-warnings {toxinidir}/tests + coverage report -m --format markdown + coverage xml + coverage html + +[base] +description = shared configuration for tests and coverage use_develop = true skip_install = false constrain_package_deps = true @@ -103,9 +114,8 @@ set_env = # constrain_package_deps = false ## deps = - pytest-plone - pytest - -c https://dist.plone.org/release/6.1-dev/constraints.txt + {[test_runner]deps} + -c constraints-mxdev.txt ## # Specify additional deps in .meta.toml: @@ -118,43 +128,64 @@ deps = # [tox] # constraints_file = "https://my-server.com/constraints.txt" ## -commands = - pytest --disable-warnings {posargs} {toxinidir}/tests extras = test -[testenv:coverage] -description = get a test coverage report -use_develop = true -skip_install = false -constrain_package_deps = true -set_env = - ROBOT_BROWSER=headlesschrome - ## -# Specify extra test environment variables in .meta.toml: +# Add extra configuration options in .meta.toml: # [tox] -# test_environment_variables = """ -# PIP_EXTRA_INDEX_URL=https://my-pypi.my-server.com/ +# skip_test_extra = true +# test_extras = """ +# tests +# widgets # """ # -# Set constrain_package_deps .meta.toml: +# Add extra configuration options in .meta.toml: # [tox] -# constrain_package_deps = "false" +# testenv_options = """ +# basepython = /usr/bin/python3.8 +# """ ## + +[testenv:test] +description = run the distribution tests +use_develop = {[base]use_develop} +skip_install = {[base]skip_install} +constrain_package_deps = {[base]constrain_package_deps} +set_env = {[base]set_env} deps = - pytest-plone - pytest + {[test_runner]deps} + -c constraints-mxdev.txt + +commands = {[test_runner]test} +extras = {[base]extras} + + +[testenv] +description = run the distribution tests (generative environments) +use_develop = {[base]use_develop} +skip_install = {[base]skip_install} +constrain_package_deps = {[base]constrain_package_deps} +set_env = {[base]set_env} +deps = {[base]deps} +commands = {[test_runner]test} +extras = {[base]extras} + + +[testenv:coverage] +description = get a test coverage report +use_develop = {[base]use_develop} +skip_install = {[base]skip_install} +constrain_package_deps = {[base]constrain_package_deps} +set_env = {[base]set_env} +deps = + {[test_runner]deps} coverage - -c https://dist.plone.org/release/6.1-dev/constraints.txt + -c constraints-mxdev.txt -commands = - coverage run --source redturtle.pasldap -m pytest {posargs} --disable-warnings {toxinidir}/tests - coverage report -m --format markdown - coverage xml -extras = - test +commands = {[test_runner]coverage} +extras = {[base]extras} [testenv:release-check] @@ -164,20 +195,22 @@ deps = twine build towncrier - -c https://dist.plone.org/release/6.1-dev/constraints.txt - + -c constraints-mxdev.txt commands = # fake version to not have to install the package # we build the change log as news entries might break # the README that is displayed on PyPI towncrier build --version=100.0.0 --yes - python -m build --sdist --no-isolation + 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 = ## @@ -192,8 +225,7 @@ allowlist_externals = deps = pipdeptree pipforester - -c https://dist.plone.org/release/6.1-dev/constraints.txt - + -c constraints-mxdev.txt commands = # Generate the full dependency tree sh -c 'pipdeptree -j > forest.json'