From f5085af446481dbcf282fba5750ac40cbb86fa17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89rico=20Andrei?= Date: Fri, 23 Jun 2023 16:49:15 -0300 Subject: [PATCH] Implement plone/meta --- .editorconfig | 24 ++- .flake8 | 22 +++ .github/workflows/code-analysis.yml | 68 ------- .github/workflows/meta.yml | 28 +++ .github/workflows/tests.yml | 25 --- .gitignore | 52 ++++- .meta.toml | 18 ++ .pre-commit-config.yaml | 84 ++++++++ Dockerfile | 4 +- Makefile | 58 ++---- frontend/dockerfiles/Dockerfile | 2 +- .../.changelog_template.jinja | 2 +- news/3.internal | 1 + pyproject.toml | 169 +++++++++++++--- .../ploneintranet/setuphandlers/__init__.py | 2 +- src/collective/ploneintranet/testing.py | 1 - tests/registration/test_distribution_volto.py | 1 - tox.ini | 183 ++++++++++++++++++ 18 files changed, 565 insertions(+), 179 deletions(-) create mode 100644 .flake8 delete mode 100644 .github/workflows/code-analysis.yml create mode 100644 .github/workflows/meta.yml create mode 100644 .meta.toml create mode 100644 .pre-commit-config.yaml rename docs/changelog_template.jinja => news/.changelog_template.jinja (96%) create mode 100644 news/3.internal create mode 100644 tox.ini diff --git a/.editorconfig b/.editorconfig index 279387b..919b411 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,6 +1,9 @@ - -# EditorConfig Configurtaion file, for more details see: -# https://EditorConfig.org +# Generated from: +# https://github.com/plone/meta/tree/master/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 @@ -26,7 +29,11 @@ max_line_length = off # 4 space indentation indent_size = 4 -[*.{html,dtml,pt,zpt,xml,zcml,js,json,less,css,yml,yaml}] +[*.{yml,zpt,pt,dtml,zcml}] +# 2 space indentation +indent_size = 2 + +[*.{json,jsonl,js,jsx,ts,tsx,css,less,scss,html}] # Frontend development # 2 space indentation indent_size = 2 @@ -35,3 +42,12 @@ indent_size = 2 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..7ef4f64 --- /dev/null +++ b/.flake8 @@ -0,0 +1,22 @@ +# Generated from: +# https://github.com/plone/meta/tree/master/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/code-analysis.yml b/.github/workflows/code-analysis.yml deleted file mode 100644 index f8e2496..0000000 --- a/.github/workflows/code-analysis.yml +++ /dev/null @@ -1,68 +0,0 @@ -name: Code Analysis - -on: - push: - -jobs: - black: - name: Black - runs-on: ubuntu-latest - - steps: - - name: Checkout codebase - uses: actions/checkout@v3 - - - name: Run check - uses: plone/code-analysis-action@v2.1 - with: - check: 'black' - - flake8: - name: flake8 - runs-on: ubuntu-latest - - steps: - - name: Checkout codebase - uses: actions/checkout@v3 - - - name: Run check - uses: plone/code-analysis-action@v2.1 - with: - check: 'flake8' - - isort: - runs-on: ubuntu-latest - steps: - - name: Checkout codebase - uses: actions/checkout@v3 - - - name: Run check - uses: plone/code-analysis-action@v2.1 - with: - check: 'isort' - - pyroma: - name: pyroma - runs-on: ubuntu-latest - - steps: - - name: Checkout codebase - uses: actions/checkout@v3 - - - name: Run check - uses: plone/code-analysis-action@v2.1 - with: - check: 'pyroma' - - zpretty: - name: zpretty - runs-on: ubuntu-latest - - steps: - - name: Checkout codebase - uses: actions/checkout@v3 - - - name: Run check - uses: plone/code-analysis-action@v2.1 - with: - check: 'zpretty' diff --git a/.github/workflows/meta.yml b/.github/workflows/meta.yml new file mode 100644 index 0000000..4748f0f --- /dev/null +++ b/.github/workflows/meta.yml @@ -0,0 +1,28 @@ +# Generated from: +# https://github.com/plone/meta/tree/master/config/default +# See the inline comments on how to expand/tweak this configuration file +name: Meta +on: + push: + branches: + - master + - main + pull_request: + branches: + - master + - main + workflow_dispatch: + +jobs: + qa: + uses: plone/meta/.github/workflows/qa.yml@master + test: + uses: plone/meta/.github/workflows/test.yml@master + coverage: + uses: plone/meta/.github/workflows/coverage.yml@master + dependencies: + uses: plone/meta/.github/workflows/dependencies.yml@master + release-ready: + uses: plone/meta/.github/workflows/release_ready.yml@master + circular: + uses: plone/meta/.github/workflows/circular.yml@master diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bafa27c..fcc1a07 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,4 +1,3 @@ - name: Test Package and create Docker Image on: [push] @@ -11,33 +10,9 @@ env: IMAGE_PLATFORMS: linux/amd64,linux/arm64 jobs: - tests: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Setup Plone ${{ env.PLONE_VERSION }} with Python ${{ env.PYTHON_VERSION }} - id: setup - uses: plone/setup-plone@v2.0.0 - with: - python-version: ${{ env.PYTHON_VERSION }} - plone-version: ${{ env.PLONE_VERSION }} - - # Install collective.ploneintranet with test extras - - name: Install collective.ploneintranet - run: | - pip install mxdev - mxdev -c mx.ini - pip install -r requirements-mxdev.txt - - # test - - name: Test Codebase - run: | - pytest --disable-warnings release: runs-on: ubuntu-latest - needs: [tests] permissions: contents: read packages: write diff --git a/.gitignore b/.gitignore index 6a5aaef..81594fd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,51 @@ +# Generated from: +# https://github.com/plone/meta/tree/master/config/default +# See the inline comments on how to expand/tweak this configuration file +# python related +*.egg-info +*.pyc +*.pyo + +# tools related +build/ .coverage +coverage.xml +dist/ +docs/_build +__pycache__/ +.tox +.vscode/ +node_modules/ + +# venv / buildout related bin/ +develop-eggs/ +eggs/ +.eggs/ +etc/ +.installed.cfg include/ -instance/ lib/ -lib64/ -pip-selfcheck.json -.pytest_cache -*/__pycache__/ +lib64 +.mr.developer.cfg +parts/ pyvenv.cfg -*-mxdev.txt +var/ + +# mxdev +/instance/ +/.make-sentinels/ +/*-mxdev.txt +/reports/ +/sources/ +/venv/ +.installed.txt + + +## +# 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..f2e60b7 --- /dev/null +++ b/.meta.toml @@ -0,0 +1,18 @@ +# Generated from: +# https://github.com/plone/meta/tree/master/config/default +# See the inline comments on how to expand/tweak this configuration file +[meta] +template = "default" +commit-id = "7983e3d9" + +[pyproject] +codespell_skip = "*.min.js" +codespell_ignores = "vew" +dependencies_ignores = "['plone.volto', 'zestreleaser.towncrier', 'zest.releaser', 'pytest', 'pytest-cov', 'pytest-plone']" +dependencies_mappings = [ + "Plone = ['Products.CMFPlone', 'Products.CMFCore', 'Products.GenericSetup']", + ] + +[tox] +test_runner = "pytest" +test_path = "/tests" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..7de9fd7 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,84 @@ +# Generated from: +# https://github.com/plone/meta/tree/master/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.4.0 + hooks: + - id: pyupgrade + args: [--py38-plus] +- repo: https://github.com/pycqa/isort + rev: 5.12.0 + hooks: + - id: isort +- repo: https://github.com/psf/black + rev: 23.3.0 + hooks: + - id: black +- repo: https://github.com/collective/zpretty + rev: 3.1.0a2 + 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: 6.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.4 + 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.21.2" + hooks: + - id: check-python-versions + args: ['--only', 'setup.py,pyproject.toml'] +- repo: https://github.com/collective/i18ndude + rev: "6.0.0" + hooks: + - id: i18ndude + +## +# Add extra configuration options in .meta.toml: +# [pre_commit] +# extra_lines = """ +# _your own configuration lines_ +# """ +## diff --git a/Dockerfile b/Dockerfile index 507c00e..3e656fa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,7 +20,7 @@ FROM plone/server-prod-config:${PLONE_VERSION} LABEL maintainer="Plone Collective " \ org.label-schema.name="collective/plone-intranet:backend" \ - org.label-schema.description="Plone Intranet distribtuion backend." \ + org.label-schema.description="Plone Intranet distribution backend." \ org.label-schema.vendor="Plone Foundation" # Disable MO Compilation @@ -32,4 +32,4 @@ COPY --from=builder /app /app RUN < Setup Virtual Env$(RESET)" $(PYTHON) -m venv . - bin/pip install -U "pip" "wheel" "cookiecutter" "mxdev" + bin/pip install -U "pip" "wheel" "cookiecutter" "mxdev" "tox" "pre-commit" + bin/pre-commit install .PHONY: config config: bin/pip ## Create instance configuration @@ -77,44 +72,27 @@ install: build-dev ## Install Plone 6.0 .PHONY: build build: build-dev ## Install Plone 6.0 - .PHONY: clean clean: ## Remove old virtualenv and creates a new one @echo "$(RED)==> Cleaning environment and build$(RESET)" - rm -rf bin lib lib64 include share etc var inituser pyvenv.cfg .installed.cfg instance + rm -rf bin lib lib64 include share etc var inituser pyvenv.cfg .installed.cfg instance .tox .pytest_cache .PHONY: start start: ## Start a Plone instance on localhost:8080 - PYTHONWARNINGS=ignore ./bin/runwsgi instance/etc/zope.ini + DEVELOP_DISTRIBUTIONS=$(DISTRIBUTIONS) PYTHONWARNINGS=ignore ./bin/runwsgi instance/etc/zope.ini + +.PHONY: console +console: ## Start a zope console + DEVELOP_DISTRIBUTIONS=$(DISTRIBUTIONS) PYTHONWARNINGS=ignore ./bin/zconsole debug instance/etc/zope.conf .PHONY: format -format: ## Format the codebase according to our standards +format: bin/tox ## Format the codebase according to our standards @echo "$(GREEN)==> Format codebase$(RESET)" - $(FORMAT) + bin/tox -e format .PHONY: lint lint: ## check code style - $(LINT) - -.PHONY: lint-black -lint-black: ## validate black formating - $(LINT) black - -.PHONY: lint-flake8 -lint-flake8: ## validate black formating - $(LINT) flake8 - -.PHONY: lint-isort -lint-isort: ## validate using isort - $(LINT) isort - -.PHONY: lint-pyroma -lint-pyroma: ## validate using pyroma - $(LINT) pyroma - -.PHONY: lint-zpretty -lint-zpretty: ## validate ZCML/XML using zpretty - $(LINT) zpretty + bin/tox -e lint # i18n bin/i18ndude: bin/pip @@ -128,8 +106,12 @@ i18n: bin/i18ndude ## Update locales # Tests .PHONY: test -test: ## run tests - bin/pytest --disable-warnings +test: bin/tox ## run tests + DEVELOP_DISTRIBUTIONS=$(DISTRIBUTIONS) bin/tox -e test + +.PHONY: test-coverage +test-coverage: bin/tox ## run tests with coverage + DEVELOP_DISTRIBUTIONS=$(DISTRIBUTIONS) bin/tox -e coverage # Docker image .PHONY: build-image diff --git a/frontend/dockerfiles/Dockerfile b/frontend/dockerfiles/Dockerfile index 9955f37..c536ff3 100644 --- a/frontend/dockerfiles/Dockerfile +++ b/frontend/dockerfiles/Dockerfile @@ -20,7 +20,7 @@ FROM plone/frontend-prod-config:${VOLTO_VERSION} LABEL maintainer="Plone Collective " \ org.label-schema.name="ghcr.io/collective/plone-intranet-backend" \ - org.label-schema.description="Plone Intranet distribtuion frontend." \ + org.label-schema.description="Plone Intranet distribution frontend." \ org.label-schema.vendor="Plone Foundation" COPY --from=builder /app/ /app/ diff --git a/docs/changelog_template.jinja b/news/.changelog_template.jinja similarity index 96% rename from docs/changelog_template.jinja rename to news/.changelog_template.jinja index 0cf429a..b35bff3 100644 --- a/docs/changelog_template.jinja +++ b/news/.changelog_template.jinja @@ -12,4 +12,4 @@ No significant changes. -{% endif %} +{% endif %} \ No newline at end of file diff --git a/news/3.internal b/news/3.internal new file mode 100644 index 0000000..4f5a678 --- /dev/null +++ b/news/3.internal @@ -0,0 +1 @@ +Implement [`plone/meta`](https://github.com/plone/meta) [@ericof] diff --git a/pyproject.toml b/pyproject.toml index 247ba1a..e9b79b5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,15 +1,12 @@ -[tool.pytest.ini_options] -addopts = "--cov-report term-missing --cov=collective.ploneintranet" -testpaths = [ - "tests", -] - +# Generated from: +# https://github.com/plone/meta/tree/master/config/default +# See the inline comments on how to expand/tweak this configuration file [tool.towncrier] -filename = "CHANGES.md" directory = "news/" +filename = "CHANGES.md" start_string = "\n" title_format = "## {version} ({project_date})" -template = "docs/changelog_template.jinja" +template = "news/.changelog_template.jinja" underlines = ["", "", ""] [[tool.towncrier.type]] @@ -27,28 +24,138 @@ directory = "bugfix" name = "Bug fixes:" showcontent = true -[tool.black] -line-length = 88 -target-version = ['py38'] -include = '\.pyi?$' +[[tool.towncrier.type]] +directory = "internal" +name = "Internal:" +showcontent = true + +[[tool.towncrier.type]] +directory = "documentation" +name = "Documentation:" +showcontent = true + +[[tool.towncrier.type]] +directory = "tests" +name = "Tests" +showcontent = true + +## +# Add extra configuration options in .meta.toml: +# [pyproject] +# towncrier_extra_lines = """ +# extra_configuration +# """ +## [tool.isort] -profile = "black" -force_alphabetical_sort = true -force_single_line = true -lines_after_imports = 2 -line_length = 120 - -[tool.flakeheaven] -format="grouped" -max_line_length=88 -show_source=true -max-complexity=25 - -[tool.flakeheaven.plugins] -pycodestyle = ["+*"] -pyflakes = ["+*"] -"flake8-*" = ["+*"] - -[tool.plone-code-analysis] -paths = "setup.py src/ tests/" +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,vew" +skip = "*.po,*.min.js" +## +# 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'] +ignore-packages = ['plone.volto', 'zestreleaser.towncrier', 'zest.releaser', 'pytest', 'pytest-cov', 'pytest-plone'] +Plone = ['Products.CMFPlone', 'Products.CMFCore', 'Products.GenericSetup'] + +## +# Add extra configuration options in .meta.toml: +# [pyproject] +# dependencies_ignores = "['zestreleaser.towncrier']" +# dependencies_mappings = [ +# "gitpython = ['git']", +# "pygithub = ['github']", +# ] +# """ +## + +[tool.check-manifest] +ignore = [ + ".editorconfig", + ".meta.toml", + ".pre-commit-config.yaml", + "tox.ini", + ".flake8", + "mx.ini", + +] +## +# Add extra configuration options in .meta.toml: +# [pyproject] +# check_manifest_ignores = """ +# "*.map.js", +# "*.pyc", +# """ +## + + +## +# Add extra configuration options in .meta.toml: +# [pyproject] +# extra_lines = """ +# _your own configuration lines_ +# """ +## diff --git a/src/collective/ploneintranet/setuphandlers/__init__.py b/src/collective/ploneintranet/setuphandlers/__init__.py index 950d123..7821e47 100644 --- a/src/collective/ploneintranet/setuphandlers/__init__.py +++ b/src/collective/ploneintranet/setuphandlers/__init__.py @@ -3,7 +3,7 @@ @implementer(INonInstallable) -class HiddenProfiles(object): +class HiddenProfiles: def getNonInstallableProfiles(self): """Hide uninstall profile from site-creation and quickinstaller.""" return [ diff --git a/src/collective/ploneintranet/testing.py b/src/collective/ploneintranet/testing.py index c7f07b8..b84ebdc 100644 --- a/src/collective/ploneintranet/testing.py +++ b/src/collective/ploneintranet/testing.py @@ -9,7 +9,6 @@ class PLONEINTRANETLayer(PloneSandboxLayer): - defaultBases = (PLONE_APP_CONTENTTYPES_FIXTURE,) def setUpZope(self, app, configurationContext): diff --git a/tests/registration/test_distribution_volto.py b/tests/registration/test_distribution_volto.py index 82831ef..6f87b9a 100644 --- a/tests/registration/test_distribution_volto.py +++ b/tests/registration/test_distribution_volto.py @@ -9,7 +9,6 @@ class TestDistributionRegistration: - distribution: Distribution = None @pytest.fixture(autouse=True) diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..238ecf4 --- /dev/null +++ b/tox.ini @@ -0,0 +1,183 @@ +# Generated from: +# https://github.com/plone/meta/tree/master/config/default +# See the inline comments on how to expand/tweak this configuration file +[tox] +# We need 4.4.0 for constrain_package_deps. +min_version = 4.4.0 +envlist = + lint + test + dependencies + + +## +# 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 +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:format] +description = automatically reformat code +skip_install = true +deps = + pre-commit +commands = + 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 = + pre-commit +commands = + pre-commit run -a + +[testenv:dependencies] +description = check if the package defines all its dependencies +skip_install = true +deps = + build + z3c.dependencychecker==2.11 +commands = + python -m build --sdist --no-isolation + dependencychecker + +[testenv:dependencies-graph] +description = generate a graph out of the dependencies of the package +skip_install = false +allowlist_externals = + sh +deps = + pipdeptree==2.5.1 + graphviz # optional dependency of pipdeptree +commands = + 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 = true +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 = + pytest-plone + pytest + -c https://dist.plone.org/release/6.0-dev/constraints.txt +## +# Specify a custom constraints file in .meta.toml: +# [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: +# [tox] +# test_environment_variables = """ +# PIP_EXTRA_INDEX_URL=https://my-pypi.my-server.com/ +# """ +## +deps = + pytest-plone + pytest + coverage + -c https://dist.plone.org/release/6.0-dev/constraints.txt +commands = + coverage run --source collective.ploneintranet -m pytest {posargs} --disable-warnings {toxinidir}/tests + coverage report -m --format markdown + coverage xml +extras = + test + + +[testenv:release-check] +description = ensure that the distribution is ready to release +skip_install = true +deps = + twine + build + towncrier + -c https://dist.plone.org/release/6.0-dev/constraints.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 + twine check dist/* + +[testenv:circular] +description = ensure there are no cyclic dependencies +use_develop = true +skip_install = false +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 = + pipdeptree + pipforester + -c https://dist.plone.org/release/6.0-dev/constraints.txt +commands = + # 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_ +# """ +##