Files
Gitcloned-CertBot/tox.ini
ohemorange 16f858547f Add --use-pep517 flag to pip to silence warning in tools/venv.py, and switch codebase to src-layout (#10249)
Fixes #10252.

See further discussion here: https://github.com/pypa/pip/issues/11457

We are doing option:

> Alternatively, enable the --use-pep517 pip option, possibly with
--no-build-isolation. The --use-pip517 flag will force pip to use the
modern mechanism for editable installs. --no-build-isolation may be
needed if your project has build-time requirements beyond setuptools and
wheel. By passing this flag, you are responsible for making sure your
environment already has the required dependencies to build your package.
Once the legacy mechanism is removed, --use-pep517 will have no effect
and will essentially be enabled by default in this context.

Major changes made here include:
- Add `--use-pep517` to use the modern mechanism, which will be the only
mechanism in future pip releases
- Change to `/src` layout to appease mypy, and because for editable
installs that really is the normal way these days.
  - `cd acme && mkdir src && mv acme src/` etc.
- add `where='src'` argument to `find_packages` and add
`package_dir={'': 'src'},` in `setup.py`s
  - update `MANIFEST.in` files with new path locations 
- Update our many hardcoded filepaths
- Update `importlib-metadata` requirement to fix
double-plugin-entry-point problem in oldest tests
2025-04-11 19:30:33 +00:00

306 lines
11 KiB
INI

[tox]
envlist = {cover,lint}-posix,mypy
skipsdist = true
[base]
pytest = python -m pytest {posargs}
# Paths are listed on one line because tox seems to have inconsistent
# behavior with substitutions that contain line continuations, see
# https://github.com/tox-dev/tox/issues/2069 for more info.
mypy_strict_source_paths = certbot-ci/src certbot-dns-cloudflare/src certbot-dns-digitalocean/src certbot-dns-dnsimple/src certbot-dns-dnsmadeeasy/src certbot-dns-gehirn/src certbot-dns-google/src certbot-dns-linode/src certbot-dns-luadns/src certbot-dns-nsone/src certbot-dns-ovh/src certbot-dns-rfc2136/src certbot-dns-route53/src certbot-dns-sakuracloud/src
mypy_no_strict_source_paths = acme/src certbot/src certbot-apache/src certbot-compatibility-test/src certbot-nginx/src
source_paths = {[base]mypy_strict_source_paths} {[base]mypy_no_strict_source_paths}
[testenv]
platform =
posix: ^(?!.*win32).*$
setenv =
PYTEST_ADDOPTS = {env:PYTEST_ADDOPTS:--numprocesses auto}
PYTHONHASHSEED = 0
# The default install command is python -I -m pip install {opts} {packages}
install_command = python -I {toxinidir}/tools/pip_install.py {opts} {packages}
deps =
-e acme[test]
-e certbot
-e certbot[test]
-e certbot-apache[dev]
-e certbot-dns-cloudflare
-e certbot-dns-digitalocean
-e certbot-dns-dnsimple
-e certbot-dns-dnsmadeeasy
-e certbot-dns-gehirn
-e certbot-dns-google
-e certbot-dns-linode
-e certbot-dns-luadns
-e certbot-dns-nsone
-e certbot-dns-ovh
-e certbot-dns-rfc2136
-e certbot-dns-route53
-e certbot-dns-sakuracloud
-e certbot-nginx
allowlist_externals =
echo
false
# This and the next few testenvs are a workaround for
# https://github.com/tox-dev/tox/issues/2858.
commands =
echo "Unrecognized environment name {envname}"
false
[testenv:py{,-posix}]
commands =
{[base]pytest} acme certbot certbot-dns-cloudflare certbot-dns-digitalocean certbot-dns-dnsimple certbot-dns-dnsmadeeasy certbot-dns-gehirn certbot-dns-google certbot-dns-linode certbot-dns-luadns certbot-dns-nsone certbot-dns-ovh certbot-dns-rfc2136 certbot-dns-route53 certbot-dns-sakuracloud certbot-nginx certbot-apache
[testenv:py3{,9,10,11,12,13}]
commands = {[testenv:py]commands}
[testenv:py3.{9,10,11,12,13}]
commands = {[testenv:py]commands}
[testenv:oldest]
# Setting basepython allows the tests to fail fast if that version of Python
# isn't available instead of potentially trying to use a newer version of
# Python which is unlikely to work.
#
# This version should be kept in sync with the one declared in
# tools/pinning/oldest/pyproject.toml.
basepython = python3.9
setenv = CERTBOT_OLDEST=1
commands = {[testenv:py]commands}
[testenv:cover]
coverage_report = python -m coverage report
common_coverage_report_commands =
{[testenv:cover]coverage_report} --fail-under 99 --include certbot-dns-cloudflare/*
{[testenv:cover]coverage_report} --fail-under 99 --include certbot-dns-digitalocean/*
{[testenv:cover]coverage_report} --fail-under 99 --include certbot-dns-dnsimple/*
{[testenv:cover]coverage_report} --fail-under 99 --include certbot-dns-dnsmadeeasy/*
{[testenv:cover]coverage_report} --fail-under 99 --include certbot-dns-gehirn/*
{[testenv:cover]coverage_report} --fail-under 99 --include certbot-dns-google/*
{[testenv:cover]coverage_report} --fail-under 100 --include certbot-dns-linode/*
{[testenv:cover]coverage_report} --fail-under 99 --include certbot-dns-luadns/*
{[testenv:cover]coverage_report} --fail-under 99 --include certbot-dns-nsone/*
{[testenv:cover]coverage_report} --fail-under 98 --include certbot-dns-ovh/*
{[testenv:cover]coverage_report} --fail-under 99 --include certbot-dns-rfc2136/*
{[testenv:cover]coverage_report} --fail-under 94 --include certbot-dns-route53/*
{[testenv:cover]coverage_report} --fail-under 99 --include certbot-dns-sakuracloud/*
{[testenv:cover]coverage_report} --fail-under 98 --include certbot-nginx/*
commands =
{[testenv:py]commands} --cov --cov-report=
{[testenv:cover]coverage_report} --fail-under 100 --include acme/*
{[testenv:cover]coverage_report} --fail-under 95 --include certbot/*
{[testenv:cover]coverage_report} --fail-under 100 --include certbot-apache/*
{[testenv:cover]common_coverage_report_commands}
# Another workaround for https://github.com/tox-dev/tox/issues/2858 in tox v4.
[testenv:cover-posix]
commands = {[testenv:cover]commands}
[testenv:lint{,-posix}]
commands = python -m pylint --reports=n --rcfile=.pylintrc {[base]source_paths}
[testenv:mypy]
deps =
{[testenv]deps}
-e certbot-ci
commands =
mypy {[base]mypy_no_strict_source_paths}
mypy {[base]mypy_strict_source_paths} --strict
[testenv:isolated-acme]
description = Tests acme without any Certbot components installed
deps = -e acme[test]
commands = {[base]pytest} acme
[testenv:isolated-certbot]
description = Tests Certbot without any additional plugins installed
deps =
{[testenv:isolated-acme]deps}
-e certbot[test]
commands = {[base]pytest} certbot
[testenv:isolated-{apache,cloudflare,digitalocean,dnsimple,dnsmadeeasy,gehirn,google,linode,luadns,nsone,ovh,rfc2136,route53,sakuracloud,nginx}]
description = Tests the plugin without installing any other plugins
deps =
{[testenv:isolated-certbot]deps}
apache: -e certbot-apache[dev]
cloudflare: -e certbot-dns-cloudflare
digitalocean: -e certbot-dns-digitalocean
dnsimple: -e certbot-dns-dnsimple
dnsmadeeasy: -e certbot-dns-dnsmadeeasy
gehirn: -e certbot-dns-gehirn
google: -e certbot-dns-google
linode: -e certbot-dns-linode
luadns: -e certbot-dns-luadns
nsone: -e certbot-dns-nsone
ovh: -e certbot-dns-ovh
rfc2136: -e certbot-dns-rfc2136
route53: -e certbot-dns-route53
sakuracloud: -e certbot-dns-sakuracloud
nginx: -e certbot-nginx
commands =
apache: {[base]pytest} certbot-apache
cloudflare: {[base]pytest} certbot-dns-cloudflare
digitalocean: {[base]pytest} certbot-dns-digitalocean
dnsimple: {[base]pytest} certbot-dns-dnsimple
dnsmadeeasy: {[base]pytest} certbot-dns-dnsmadeeasy
gehirn: {[base]pytest} certbot-dns-gehirn
google: {[base]pytest} certbot-dns-google
linode: {[base]pytest} certbot-dns-linode
luadns: {[base]pytest} certbot-dns-luadns
nsone: {[base]pytest} certbot-dns-nsone
ovh: {[base]pytest} certbot-dns-ovh
rfc2136: {[base]pytest} certbot-dns-rfc2136
route53: {[base]pytest} certbot-dns-route53
sakuracloud: {[base]pytest} certbot-dns-sakuracloud
nginx: {[base]pytest} certbot-nginx
[testenv:apacheconftest]
deps =
-e acme
-e certbot
-e certbot-apache
commands =
{toxinidir}/certbot-apache/src/certbot_apache/_internal/tests/apache-conf-files/apache-conf-test --debian-modules
passenv =
SERVER
allowlist_externals =
{toxinidir}/certbot-apache/src/certbot_apache/_internal/tests/apache-conf-files/apache-conf-test
[testenv:apacheconftest-external-with-pebble]
description = Run apacheconftest with pebble and Certbot outside of the tox virtual environment.
deps =
-e certbot-ci
allowlist_externals =
{toxinidir}/certbot-apache/src/certbot_apache/_internal/tests/apache-conf-files/apache-conf-test-pebble.py
commands =
{toxinidir}/certbot-apache/src/certbot_apache/_internal/tests/apache-conf-files/apache-conf-test-pebble.py --debian-modules
[testenv:apacheconftest-with-pebble]
deps =
{[testenv:apacheconftest]deps}
{[testenv:apacheconftest-external-with-pebble]deps}
allowlist_externals =
{toxinidir}/certbot-apache/src/certbot_apache/_internal/tests/apache-conf-files/apache-conf-test-pebble.py
commands = {[testenv:apacheconftest-external-with-pebble]commands}
[testenv:nginxroundtrip]
deps =
-e acme
-e certbot
-e certbot-apache
-e certbot-nginx
commands =
python certbot-compatibility-test/nginx/roundtrip.py certbot-compatibility-test/nginx/nginx-roundtrip-testdata
[testenv:modification]
deps =
commands =
python {toxinidir}/tests/modification-check.py
[testenv:apache_compat]
deps =
commands =
docker build -t certbot-compatibility-test -f certbot-compatibility-test/Dockerfile .
docker build -t apache-compat -f certbot-compatibility-test/Dockerfile-apache .
docker run --rm -t apache-compat -c apache.tar.gz -vvvv
allowlist_externals =
docker
passenv =
DOCKER_*
[testenv:nginx_compat]
deps =
commands =
docker build -t certbot-compatibility-test -f certbot-compatibility-test/Dockerfile .
docker build -t nginx-compat -f certbot-compatibility-test/Dockerfile-nginx .
docker run --rm -t nginx-compat -c nginx.tar.gz -vv -aie
allowlist_externals =
docker
passenv =
DOCKER_*
[testenv:integration]
deps =
-e acme
-e certbot
-e certbot-nginx
-e certbot-ci
commands =
{[base]pytest} certbot-ci/src/certbot_integration_tests \
--cov=acme --cov=certbot --cov=certbot_nginx --cov-report= \
--cov-config=certbot-ci/src/certbot_integration_tests/.coveragerc
coverage report --include 'certbot/*' --show-missing --fail-under=65
coverage report --include 'certbot-nginx/*' --show-missing --fail-under=74
passenv = DOCKER_*
[testenv:integration-certbot]
deps =
-e acme
-e certbot
-e certbot-ci
commands =
{[base]pytest} certbot-ci/src/certbot_integration_tests/certbot_tests \
--cov=acme --cov=certbot --cov-report= \
--cov-config=certbot-ci/src/certbot_integration_tests/.coveragerc
coverage report --include 'certbot/*' --show-missing --fail-under=62
[testenv:integration-dns-rfc2136]
deps =
-e acme
-e certbot
-e certbot-dns-rfc2136
-e certbot-ci
commands =
{[base]pytest} certbot-ci/src/certbot_integration_tests/rfc2136_tests \
--dns-server=bind \
--numprocesses=1 \
--cov=acme --cov=certbot --cov=certbot_dns_rfc2136 --cov-report= \
--cov-config=certbot-ci/src/certbot_integration_tests/.coveragerc
coverage report --include 'certbot/*' --show-missing --fail-under=45
coverage report --include 'certbot-dns-rfc2136/*' --show-missing --fail-under=86
[testenv:integration-external]
description = Run integration tests with Certbot outside of the tox virtual environment.
deps =
-e certbot-ci
commands =
{[base]pytest} certbot-ci/src/certbot_integration_tests
passenv = DOCKER_*
[testenv:integration-certbot-oldest]
deps =
-e acme
-e certbot
-e certbot-ci
basepython =
{[testenv:oldest]basepython}
commands =
{[base]pytest} certbot-ci/src/certbot_integration_tests/certbot_tests
passenv = DOCKER_*
setenv = {[testenv:oldest]setenv}
[testenv:integration-nginx-oldest]
deps =
-e acme
-e certbot
-e certbot-nginx
-e certbot-ci
basepython =
{[testenv:oldest]basepython}
commands =
{[base]pytest} certbot-ci/src/certbot_integration_tests/nginx_tests
passenv = DOCKER_*
setenv = {[testenv:oldest]setenv}
[testenv:test-farm-apache2]
passenv =
AWS_*
setenv = AWS_DEFAULT_REGION=us-east-1
changedir = letstest
deps = -e {toxinidir}/letstest
commands = {toxinidir}/tools/retry.sh letstest targets/targets.yaml {env:AWS_EC2_PEM_FILE} SET_BY_ENV scripts/test_apache2.sh --repo {toxinidir}
allowlist_externals =
{toxinidir}/tools/retry.sh