From 650611bd1f2a3500e27da7c94ae99608250d95b2 Mon Sep 17 00:00:00 2001 From: Brad Warren Date: Thu, 8 Jun 2017 12:22:46 -0700 Subject: [PATCH] Fix oldest tests (#4782) * Add pip_install_editable.sh * add install_and_test.sh * simplify tox.ini and fix oldest tests * Put paths & packages on their own line in tox.ini --- tools/install_and_test.sh | 21 +++++ tools/pip_install_editable.sh | 10 +++ tox.ini | 154 ++++++++++++++++------------------ 3 files changed, 102 insertions(+), 83 deletions(-) create mode 100755 tools/install_and_test.sh create mode 100755 tools/pip_install_editable.sh diff --git a/tools/install_and_test.sh b/tools/install_and_test.sh new file mode 100755 index 000000000..0de2ea3f8 --- /dev/null +++ b/tools/install_and_test.sh @@ -0,0 +1,21 @@ +#!/bin/sh -e +# 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. If CERTBOT_NO_PIN is set not +# set to 1, packages are installed using certbot-auto's requirements file as +# constraints. + +if [ "$CERTBOT_NO_PIN" = 1 ]; then + pip_install="pip install -e" +else + pip_install="$(dirname $0)/pip_install_editable.sh" +fi + +for requirement in "$@" ; do + $pip_install $requirement + pkg=$(echo $requirement | cut -f1 -d\[) # remove any extras such as [dev] + if [ $pkg = "." ]; then + pkg="certbot" + fi + nosetests -v $pkg --processes=-1 --process-timeout=100 +done diff --git a/tools/pip_install_editable.sh b/tools/pip_install_editable.sh new file mode 100755 index 000000000..6130bf6e7 --- /dev/null +++ b/tools/pip_install_editable.sh @@ -0,0 +1,10 @@ +#!/bin/sh -e +# pip installs packages in editable mode using certbot-auto's requirements file +# as constraints + +args="" +for requirement in "$@" ; do + args="$args -e $requirement" +done + +"$(dirname $0)/pip_install.sh" $args diff --git a/tox.ini b/tox.ini index 8279a687f..6db60c882 100644 --- a/tox.ini +++ b/tox.ini @@ -10,102 +10,90 @@ envlist = modification,py{26,33,34,35,36},cover,lint # loops, especially on Travis [base] -# wraps pip install to use pinned versions of dependencies -pip_install = {toxinidir}/tools/pip_install.sh -# packages installed separately to ensure that downstream deps problems -# are detected, c.f. #1002 -core_commands = - {[base]pip_install} -e acme[dev] - nosetests -v acme --processes=-1 - {[base]pip_install} -e .[dev] - nosetests -v certbot --processes=-1 --process-timeout=100 -core_install_args = -e acme[dev] -e .[dev] -core_paths = acme/acme certbot +# pip installs the requested packages in editable mode +pip_install = {toxinidir}/tools/pip_install_editable.sh +# 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. If CERTBOT_NO_PIN is set not +# set to 1, packages are installed using certbot-auto's requirements file as +# constraints. +install_and_test = {toxinidir}/tools/install_and_test.sh +py26_packages = + acme[dev] \ + .[dev] \ + certbot-apache \ + certbot-dns-cloudflare \ + certbot-dns-digitalocean \ + certbot-dns-google \ + certbot-dns-route53 \ + certbot-nginx \ + letshelp-certbot +non_py26_packages = + certbot-dns-cloudxns \ + certbot-dns-dnsimple \ + certbot-dns-nsone +all_packages = + {[base]py26_packages} {[base]non_py26_packages} +install_packages = + {toxinidir}/tools/pip_install_editable.sh {[base]all_packages} +source_paths = + acme/acme + certbot + certbot-apache/certbot_apache + certbot-compatibility-test/certbot_compatibility_test + certbot-dns-cloudflare/certbot_dns_cloudflare + certbot-dns-cloudxns/certbot_dns_cloudxns + certbot-dns-digitalocean/certbot_dns_digitalocean + certbot-dns-dnsimple/certbot_dns_dnsimple + certbot-dns-google/certbot_dns_google + certbot-dns-nsone/certbot_dns_nsone + certbot-dns-route53/certbot_dns_route53 + certbot-nginx/certbot_nginx + letshelp-certbot/letshelp_certbot + tests/lock_test.py -plugin_commands = - {[base]pip_install} -e certbot-apache - nosetests -v certbot_apache --processes=-1 --process-timeout=80 - {[base]pip_install} -e certbot-nginx - nosetests -v certbot_nginx --processes=-1 -plugin_install_args = -e certbot-apache -e certbot-nginx -plugin_paths = certbot-apache/certbot_apache certbot-nginx/certbot_nginx - -dns_plugin_commands = - pip install -e certbot-dns-cloudflare - nosetests -v certbot_dns_cloudflare --processes=-1 - pip install -e certbot-dns-digitalocean - nosetests -v certbot_dns_digitalocean --processes=-1 - pip install -e certbot-dns-google - nosetests -v certbot_dns_google --processes=-1 - pip install -e certbot-dns-route53 - nosetests -v certbot_dns_route53 --processes=-1 --process-timeout=25 -dns_plugin_install_args = -e certbot-dns-cloudflare -e certbot-dns-digitalocean -e certbot-dns-google -e certbot-dns-route53 -dns_plugin_paths = certbot-dns-cloudflare/certbot_dns_cloudflare certbot-dns-digitalocean/certbot_dns_digitalocean certbot-dns-google/certbot_dns_google certbot-dns-route53/certbot_dns_route53 - -lexicon_dns_plugin_commands = - pip install -e certbot-dns-cloudxns - nosetests -v certbot_dns_cloudxns --processes=-1 - pip install -e certbot-dns-dnsimple - nosetests -v certbot_dns_dnsimple --processes=-1 - pip install -e certbot-dns-nsone - nosetests -v certbot_dns_nsone --processes=-1 -lexicon_dns_plugin_install_args = -e certbot-dns-cloudxns -e certbot-dns-dnsimple -e certbot-dns-nsone -lexicon_dns_plugin_paths = certbot-dns-cloudxns/certbot_dns_cloudxns certbot-dns-dnsimple/certbot_dns_dnsimple certbot-dns-nsone/certbot_dns_nsone - -compatibility_install_args = -e certbot-compatibility-test -compatibility_paths = certbot-compatibility-test/certbot_compatibility_test - -other_commands = - {[base]pip_install} -e letshelp-certbot - nosetests -v letshelp_certbot --processes=-1 - python tests/lock_test.py -other_install_args = -e letshelp-certbot -other_paths = letshelp-certbot/letshelp_certbot tests/lock_test.py - -[testenv] +[testenv:py26] commands = - {[base]core_commands} - {[base]plugin_commands} - {[base]dns_plugin_commands} - {[base]lexicon_dns_plugin_commands} - {[base]other_commands} - -setenv = - PYTHONPATH = {toxinidir} - PYTHONHASHSEED = 0 -# https://testrun.org/tox/latest/example/basic.html#special-handling-of-pythonhas + {[base]install_and_test} {[base]py26_packages} + python tests/lock_test.py +[testenv:py26-oldest] +commands = + {[testenv:py26]commands} # cffi<=1.7 is required for oldest tests due to # https://bitbucket.org/cffi/cffi/commits/18cdf37d6b2691301a15b0e54f49757ebd4ed0f2?at=default # requests<=2.11.1 required for oldest tests due to # https://github.com/shazow/urllib3/pull/930 deps = - py{26,27}-oldest: cffi<=1.7 - py{26,27}-oldest: cryptography==1.2 - py{26,27}-oldest: configargparse==0.10.0 - py{26,27}-oldest: PyOpenSSL==0.13 - py{26,27}-oldest: requests<=2.11.1 + cffi<=1.7 + cryptography==1.2 + configargparse==0.10.0 + PyOpenSSL==0.13 + requests<=2.11.1 +setenv = + CERTBOT_NO_PIN=1 -[testenv:py26] -commands = - {[base]core_commands} - {[base]plugin_commands} - {[base]dns_plugin_commands} - {[base]other_commands} - -[testenv:py26-oldest] +[testenv] commands = {[testenv:py26]commands} + {[base]install_and_test} {[base]non_py26_packages} +setenv = + PYTHONPATH = {toxinidir} + PYTHONHASHSEED = 0 + py27-oldest: {[testenv:py26-oldest]setenv} +# https://testrun.org/tox/latest/example/basic.html#special-handling-of-pythonhas +deps = + py27-oldest: {[testenv:py26-oldest]deps} [testenv:py27_install] basepython = python2.7 commands = - {[base]pip_install} {[base]core_install_args} {[base]plugin_install_args} {[base]dns_plugin_install_args} {[base]lexicon_dns_plugin_install_args} {[base]other_install_args} + {[base]install_packages} [testenv:cover] basepython = python2.7 commands = - {[base]pip_install} {[base]core_install_args} {[base]plugin_install_args} {[base]dns_plugin_install_args} {[base]lexicon_dns_plugin_install_args} {[base]other_install_args} + {[base]install_packages} ./tox.cover.sh [testenv:lint] @@ -115,25 +103,25 @@ basepython = python2.7 # duplicate code checking; if one of the commands fails, others will # continue, but tox return code will reflect previous error commands = - {[base]pip_install} -q {[base]core_install_args} {[base]plugin_install_args} {[base]dns_plugin_install_args} {[base]lexicon_dns_plugin_install_args} {[base]compatibility_install_args} {[base]other_install_args} - pylint --reports=n --rcfile=.pylintrc {[base]core_paths} {[base]plugin_paths} {[base]dns_plugin_paths} {[base]lexicon_dns_plugin_paths} {[base]compatibility_paths} {[base]other_paths} + {[base]install_packages} + pylint --reports=n --rcfile=.pylintrc {[base]source_paths} [testenv:mypy] basepython = python3.4 commands = {[base]pip_install} mypy - {[base]pip_install} -q {[base]core_install_args} {[base]plugin_install_args} {[base]dns_plugin_install_args} {[base]lexicon_dns_plugin_install_args} {[base]compatibility_install_args} {[base]other_install_args} - mypy --py2 --ignore-missing-imports {[base]core_paths} {[base]plugin_paths} {[base]dns_plugin_paths} {[base]lexicon_dns_plugin_paths} {[base]compatibility_paths} {[base]other_paths} + {[base]install_packages} + mypy --py2 --ignore-missing-imports {[base]source_paths} [testenv:apacheconftest] #basepython = python2.7 commands = - {[base]pip_install} {[base]core_install_args} {[base]plugin_install_args} {[base]compatibility_install_args} {[base]other_install_args} + {[base]pip_install} acme . certbot-apache certbot-compatibility-test {toxinidir}/certbot-apache/certbot_apache/tests/apache-conf-files/apache-conf-test --debian-modules [testenv:nginxroundtrip] commands = - {[base]pip_install} {[base]core_install_args} -e certbot-nginx + {[base]pip_install} acme . certbot-apache certbot-nginx python certbot-compatibility-test/nginx/roundtrip.py certbot-compatibility-test/nginx/nginx-roundtrip-testdata # This is a duplication of the command line in testenv:le_auto to