[Windows|Unix] Rewrite bash scripts for tests into python (#6435)

Certbot relies heavily on bash scripts to deploy a development environment and to execute tests. This is fine for Linux systems, including Travis, but problematic for Windows machines.

This PR converts all theses scripts into Python, to make them platform independant.

As a consequence, tox-win.ini is not needed anymore, and tox can be run indifferently on Windows or on Linux using a common tox.ini. AppVeyor is updated accordingly to execute tests for acme, certbot and all dns plugins. Other tests are not executed as they are for Docker, unsupported Apache/Nginx/Postfix plugins (for now) or not relevant for Windows (explicit Linux distribution tests or pylint).

Another PR will be done on certbot website to update how a dev environment can be set up.

* Replace several shell scripts by python equivalent.

* Correction on tox coverage

* Extend usage of new python scripts

* Various corrections

* Replace venv construction bash scripts by python equivalents

* Update tox.ini

* Unicode lines to compare files

* Put modifications on letsencrypt-auto-source instead of generated scripts

* Add executable permissions for Linux.

* Merge tox win tests into main tox

* Skip lock_test on Windows

* Correct appveyor config

* Update appveyor.yml

* Explicit coverage py27 or py37

* Avoid to cover non supported certbot plugins on Windows

* Update tox.ini

* Remove specific warnings during CI

* No cover on a debug code for tests only.

* Update documentation and help script on venv/venv3.py

* Customize help message for Windows

* Quote correctly executable path with potential spaces in it.

* Copy pipstrap from upstream
This commit is contained in:
Adrien Ferrand
2018-11-07 17:16:16 -08:00
committed by Brad Warren
parent b17c322483
commit 3d0e16ece3
33 changed files with 643 additions and 377 deletions
+18 -10
View File
@@ -4,16 +4,16 @@
[tox]
skipsdist = true
envlist = modification,py{34,35,36},cover,lint
envlist = modification,py{34,35,36},py27-cover,lint
[base]
# pip installs the requested packages in editable mode
pip_install = {toxinidir}/tools/pip_install_editable.sh
pip_install = python {toxinidir}/tools/pip_install_editable.py
# pip installs the requested packages in editable mode and runs unit tests on
# them. Each package is installed and tested in the order they are provided
# before the script moves on to the next package. All dependencies are pinned
# to a specific version for increased stability for developers.
install_and_test = {toxinidir}/tools/install_and_test.sh
install_and_test = python {toxinidir}/tools/install_and_test.py
dns_packages =
certbot-dns-cloudflare \
certbot-dns-cloudxns \
@@ -38,7 +38,7 @@ all_packages =
certbot-postfix \
letshelp-certbot
install_packages =
{toxinidir}/tools/pip_install_editable.sh {[base]all_packages}
python {toxinidir}/tools/pip_install_editable.py {[base]all_packages}
source_paths =
acme/acme
certbot
@@ -64,7 +64,9 @@ source_paths =
tests/lock_test.py
[testenv]
passenv = TRAVIS
passenv =
TRAVIS
APPVEYOR
commands =
{[base]install_and_test} {[base]all_packages}
python tests/lock_test.py
@@ -120,11 +122,17 @@ basepython = python2.7
commands =
{[base]install_packages}
[testenv:cover]
[testenv:py27-cover]
basepython = python2.7
commands =
{[base]install_packages}
./tox.cover.sh
python tox.cover.py
[testenv:py37-cover]
basepython = python3.7
commands =
{[base]install_packages}
python tox.cover.py
[testenv:lint]
basepython = python2.7
@@ -133,7 +141,7 @@ basepython = python2.7
# continue, but tox return code will reflect previous error
commands =
{[base]install_packages}
pylint --reports=n --rcfile=.pylintrc {[base]source_paths}
python -m pylint --reports=n --rcfile=.pylintrc {[base]source_paths}
[testenv:mypy]
basepython = python3
@@ -157,7 +165,7 @@ commands =
# allow users to run the modification check by running `tox`
[testenv:modification]
commands =
{toxinidir}/tests/modification-check.sh
python {toxinidir}/tests/modification-check.py
[testenv:apache_compat]
commands =
@@ -197,7 +205,7 @@ passenv =
# At the moment, this tests under Python 2.7 only, as only that version is
# readily available on the Trusty Docker image.
commands =
{toxinidir}/tests/modification-check.sh
python {toxinidir}/tests/modification-check.py
docker build -f letsencrypt-auto-source/Dockerfile.trusty -t lea letsencrypt-auto-source
docker run --rm -t -i lea
whitelist_externals =