Skip to content

Commit

Permalink
Update tox
Browse files Browse the repository at this point in the history
  • Loading branch information
1letter committed Apr 19, 2024
1 parent bb20d42 commit 85f1b08
Showing 1 changed file with 180 additions and 171 deletions.
351 changes: 180 additions & 171 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,206 +1,215 @@
# Generated from:
# https://github.com/plone/meta/tree/main/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 =
py37-lint,
py38-lint,
py39-lint,
black-check,
py{38,37}-Plone{52},
py{39}-Plone{60},
# docs,
# coverage-report,

skip_missing_interpreters = True

[gh-actions]
python =
3.7: py37
3.8: py38
3.9: py39

[gh-actions:env]
PLONE-VERSION =
Plone52: Plone52
Plone60: Plone60

[testenv]
skip_install = true

passenv=*

extras =
develop
lint
test
dependencies

commands =
{envbindir}/buildout -c {env:version_file} buildout:directory={envdir} buildout:develop={toxinidir} bootstrap
{envbindir}/buildout -c {env:version_file} buildout:directory={envdir} buildout:develop={toxinidir} annotate
{envbindir}/buildout -c {env:version_file} buildout:directory={envdir} buildout:develop={toxinidir} install test robot code-analysis
coverage run {envbindir}/test -v1 --auto-color {posargs}
# coverage run {envbindir}/test -v --all -t robot {posargs}

setenv =
COVERAGE_FILE=.coverage.{envname}
version_file = {toxinidir}/test_plone60.cfg
Plone52: version_file={toxinidir}/test_plone52.cfg
Plone60: version_file={toxinidir}/test_plone60.cfg

deps =
Plone52: -rrequirements_plone52.txt
Plone52: -cconstraints_plone52.txt
Plone60: -rrequirements_plone60.txt
Plone60: -cconstraints_plone60.txt
coverage
##
# Add extra configuration options in .meta.toml:
# [tox]
# envlist_lines = """
# my_other_environment
# """
# config_lines = """
# my_extra_top_level_tox_configuration_lines
# """
##

[testenv:coverage-report]
[testenv]
skip_install = true
usedevelop = True
basepython = python3.9

deps =
coverage
-cconstraints_plone60.txt

setenv =
COVERAGE_FILE=.coverage

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 =
coverage erase
coverage combine
coverage html
coverage xml
coverage report
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
commands =
echo "Initial setup complete"


[lint]
[testenv:format]
description = automatically reformat code
skip_install = true

deps =
-cconstraints.txt
isort
flake8
# helper to generate HTML reports:
flake8-html
# 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 --format=html --htmldir={toxinidir}/reports/flake8 --doctests {toxinidir}/src {toxinidir}/setup.py
flake8 --doctests {toxinidir}/src {toxinidir}/setup.py
isort --check-only {toxinidir}/src {toxinidir}/setup.py
# black --check --diff -v {toxinidir}/src {toxinidir}/setup.py
pre-commit run -a pyupgrade
pre-commit run -a isort
pre-commit run -a black
pre-commit run -a zpretty

whitelist_externals =
mkdir


[testenv:isort-apply]
[testenv:lint]
description = run linters that will help improve the code style
skip_install = true

deps =
-cconstraints.txt
isort

pre-commit
commands =
isort {toxinidir}/src {toxinidir}/setup.py
pre-commit run -a


[testenv:black-check]
basepython = python3.9
skip_install = True
[testenv:dependencies]
description = check if the package defines all its dependencies
skip_install = true
deps =
-cconstraints.txt
black

build
z3c.dependencychecker==2.14.3
commands =
black --check --diff -v src setup.py


[testenv:black-enforce]
basepython = python3.9
skip_install = True
python -m build --sdist
dependencychecker

[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 -v src setup.py


[testenv:py37-lint]
basepython = python3.7
skip_install = true
deps = {[lint]deps}
commands = {[lint]commands}
whitelist_externals = {[lint]whitelist_externals}

[testenv:py38-lint]
basepython = python3.8
skip_install = true
deps = {[lint]deps}
commands = {[lint]commands}
whitelist_externals = {[lint]whitelist_externals}

[testenv:py39-lint]
basepython = python3.9
skip_install = true
deps = {[lint]deps}
commands = {[lint]commands}
whitelist_externals = {[lint]whitelist_externals}

[testenv:docs]
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 = 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/
# """
#
# Set constrain_package_deps .meta.toml:
# [tox]
# constrain_package_deps = "false"
##
deps =
Sphinx

zope.testrunner
-c https://dist.plone.org/release/6.0-dev/constraints.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 =
sphinx-build -b html -d _build/docs/doctrees docs _build/docs/html

[testenv:update_translation]
skip_install = true
zope-testrunner --all --test-path={toxinidir}/src -s collective.z3cform.norobots {posargs}
extras =
test

##
# 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 = 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 =
i18ndude
coverage
zope.testrunner
-c https://dist.plone.org/release/6.0-dev/constraints.txt

commands =
i18ndude find-untranslated
i18ndude rebuild-pot
i18ndude merge
i18ndude sync
i18ndude list
coverage run --branch --source collective.z3cform.norobots {envbindir}/zope-testrunner --quiet --all --test-path={toxinidir}/src -s collective.z3cform.norobots {posargs}
coverage report -m --format markdown
coverage xml
coverage html
extras =
test

[testenv:release]
skip_install = true

[testenv:release-check]
description = ensure that the distribution is ready to release
skip_install = true
deps =
zest.releaser[recommended]
twine
build
-c https://dist.plone.org/release/6.0-dev/constraints.txt

commands =
fullrelease --no-input -v

[testenv:build_instance]
basepython = python2.7
skip_install = true
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 =
pipdeptree
pipforester
-c https://dist.plone.org/release/6.0-dev/constraints.txt

commands =
{envbindir}/buildout -c {env:version_file} buildout:directory={toxinidir} bootstrap
{envbindir}/buildout -c {env:version_file} buildout:directory={toxinidir} annotate
{envbindir}/buildout -c {env:version_file} buildout:directory={toxinidir}
# 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_
# """
##

0 comments on commit 85f1b08

Please sign in to comment.