From 78e3b09cba1fcafb2d5a17ccf714b3faecb48d5f Mon Sep 17 00:00:00 2001 From: Adrien Ferrand Date: Fri, 10 May 2019 23:11:45 +0200 Subject: [PATCH 1/4] Update .travis.yml Co-Authored-By: Brad Warren --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7e694a6eb..a423bb4a6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ cache: before_script: - 'if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ulimit -n 1024 ; fi' - # On Travis, the fastest parallelization for integration tests is proved to be 4. + # On Travis, the fastest parallelization for integration tests has proved to be 4. - 'if [[ "$TOXENV" == *"integration"* ]]; then export PYTEST_ADDOPTS="--numprocesses 4"; fi' - export TOX_TESTENV_PASSENV=TRAVIS From 25c41c2b011018744709aafaba6f7290966103a8 Mon Sep 17 00:00:00 2001 From: Adrien Ferrand Date: Fri, 10 May 2019 21:16:15 +0200 Subject: [PATCH 2/4] Clean travis.yml, split other tests --- .travis.yml | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index a423bb4a6..3a054b419 100644 --- a/.travis.yml +++ b/.travis.yml @@ -110,13 +110,9 @@ matrix: <<: *extended-test-suite - python: "2.7" env: TOXENV=py27-certbot-oldest - sudo: required - services: docker <<: *extended-test-suite - python: "2.7" env: TOXENV=py27-nginx-oldest - sudo: required - services: docker <<: *extended-test-suite - python: "2.7" env: ACME_SERVER=boulder-v1 TOXENV=integration-certbot-oldest @@ -139,44 +135,57 @@ matrix: services: docker <<: *extended-test-suite - python: "3.4" - env: ACME_SERVER=boulder-v1 TOXENV=py34,integration + env: TOXENV=py34 + <<: *extended-test-suite + - python: "3.5" + env: TOXENV=py35 + <<: *extended-test-suite + - python: "3.6" + env: TOXENV=py36 + <<: *extended-test-suite + - python: "3.7" + dist: xenial + env: TOXENV=py37 + <<: *extended-test-suite + - python: "3.4" + env: ACME_SERVER=boulder-v1 TOXENV=integration sudo: required services: docker <<: *extended-test-suite - python: "3.4" - env: ACME_SERVER=boulder-v2 TOXENV=py34,integration + env: ACME_SERVER=boulder-v2 TOXENV=integration sudo: required services: docker <<: *extended-test-suite - python: "3.5" - env: ACME_SERVER=boulder-v1 TOXENV=py35,integration + env: ACME_SERVER=boulder-v1 TOXENV=integration sudo: required services: docker <<: *extended-test-suite - python: "3.5" - env: ACME_SERVER=boulder-v2 TOXENV=py35,integration + env: ACME_SERVER=boulder-v2 TOXENV=integration sudo: required services: docker <<: *extended-test-suite - python: "3.6" - env: ACME_SERVER=boulder-v1 TOXENV=py36,integration + env: ACME_SERVER=boulder-v1 TOXENV=integration sudo: required services: docker <<: *extended-test-suite - python: "3.6" - env: ACME_SERVER=boulder-v2 TOXENV=py36,integration + env: ACME_SERVER=boulder-v2 TOXENV=integration sudo: required services: docker <<: *extended-test-suite - python: "3.7" dist: xenial - env: ACME_SERVER=boulder-v1 TOXENV=py37,integration + env: ACME_SERVER=boulder-v1 TOXENV=integration sudo: required services: docker <<: *extended-test-suite - python: "3.7" dist: xenial - env: ACME_SERVER=boulder-v2 TOXENV=py37,integration + env: ACME_SERVER=boulder-v2 TOXENV=integration sudo: required services: docker <<: *extended-test-suite From 03453ad51fd0d359c24d27b32b1cfdf102d20af3 Mon Sep 17 00:00:00 2001 From: Adrien Ferrand Date: Fri, 10 May 2019 21:19:30 +0200 Subject: [PATCH 3/4] Remove useless config --- tox.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/tox.ini b/tox.ini index 24050041a..97f87a8fa 100644 --- a/tox.ini +++ b/tox.ini @@ -256,7 +256,6 @@ commands = coverage report --include 'certbot/*' --show-missing --fail-under=67 coverage report --include 'certbot-nginx/*' --show-missing --fail-under=74 passenv = DOCKER_* -setenv = {[testenv]setenv} [testenv:integration-certbot-oldest] commands = From ac4f6e826a75af00fe467b50550f31a225ad55f8 Mon Sep 17 00:00:00 2001 From: Adrien Ferrand Date: Fri, 10 May 2019 21:41:41 +0200 Subject: [PATCH 4/4] Move back config in conftest.py, add pytest.ini to resolve correctly rootdir --- .../{utils/pytest_plugin.py => conftest.py} | 11 +++++------ certbot-ci/local-oldest-requirements.txt | 4 ---- certbot-ci/pytest.ini | 0 certbot-ci/setup.py | 5 ----- tox.ini | 8 ++++---- 5 files changed, 9 insertions(+), 19 deletions(-) rename certbot-ci/certbot_integration_tests/{utils/pytest_plugin.py => conftest.py} (90%) delete mode 100644 certbot-ci/local-oldest-requirements.txt create mode 100644 certbot-ci/pytest.ini diff --git a/certbot-ci/certbot_integration_tests/utils/pytest_plugin.py b/certbot-ci/certbot_integration_tests/conftest.py similarity index 90% rename from certbot-ci/certbot_integration_tests/utils/pytest_plugin.py rename to certbot-ci/certbot_integration_tests/conftest.py index aab9d138b..892c16266 100644 --- a/certbot-ci/certbot_integration_tests/utils/pytest_plugin.py +++ b/certbot-ci/certbot_integration_tests/conftest.py @@ -18,9 +18,10 @@ def pytest_addoption(parser): Standard pytest hook to add options to the pytest parser. :param parser: current pytest parser that will be used on the CLI """ - parser.addoption('--acme-server', + parser.addoption('--acme-server', default='pebble', choices=['boulder-v1', 'boulder-v2', 'pebble'], - help='select the ACME server to use (boulder-v1, boulder-v2, pebble)') + help='select the ACME server to use (boulder-v1, boulder-v2, ' + 'pebble), defaulting to pebble') def pytest_configure(config): @@ -28,8 +29,7 @@ def pytest_configure(config): Standard pytest hook used to add a configuration logic for each node of a pytest run. :param config: the current pytest configuration """ - acme_server = config.option.acme_server if hasattr(config.option, 'acme_server') else None - if not hasattr(config, 'slaveinput') and acme_server: # If true, this is the primary node + if not hasattr(config, 'slaveinput'): # If true, this is the primary node with _print_on_err(): config.acme_xdist = _setup_primary_node(config) @@ -39,8 +39,7 @@ def pytest_configure_node(node): Standard pytest-xdist hook used to configure a worker node. :param node: current worker node """ - if hasattr(node.config, 'acme_xdist'): - node.slaveinput['acme_xdist'] = node.config.acme_xdist + node.slaveinput['acme_xdist'] = node.config.acme_xdist @contextlib.contextmanager diff --git a/certbot-ci/local-oldest-requirements.txt b/certbot-ci/local-oldest-requirements.txt deleted file mode 100644 index 09d6eed1a..000000000 --- a/certbot-ci/local-oldest-requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -# Even if only pyparsing 1.5.6 is available on CentOS 6, version 2.0.2 is required -# to make pytest plugins auto-discovery working. No breaking change is done from 1.5.6 -# besides removal of support to Python < 2.6, that is irrelevant for oldest tests. -pyparsing==2.0.2 diff --git a/certbot-ci/pytest.ini b/certbot-ci/pytest.ini new file mode 100644 index 000000000..e69de29bb diff --git a/certbot-ci/setup.py b/certbot-ci/setup.py index 28765dc12..9bbd18022 100644 --- a/certbot-ci/setup.py +++ b/certbot-ci/setup.py @@ -46,9 +46,4 @@ setup( packages=find_packages(), include_package_data=True, install_requires=install_requires, - entry_points={ - 'pytest11': [ - 'acme-xdist = certbot_integration_tests.utils.pytest_plugin' - ] - } ) diff --git a/tox.ini b/tox.ini index 97f87a8fa..7f2c18d38 100644 --- a/tox.ini +++ b/tox.ini @@ -249,10 +249,10 @@ passenv = DOCKER_* [testenv:integration] commands = {[base]pip_install} acme . certbot-nginx certbot-ci - pytest --pyargs certbot_integration_tests \ + pytest certbot-ci/certbot_integration_tests \ --acme-server={env:ACME_SERVER:pebble} \ --cov=acme --cov=certbot --cov=certbot_nginx --cov-report= \ - --cov-config={toxinidir}/certbot-ci/certbot_integration_tests/.coveragerc + --cov-config=certbot-ci/certbot_integration_tests/.coveragerc coverage report --include 'certbot/*' --show-missing --fail-under=67 coverage report --include 'certbot-nginx/*' --show-missing --fail-under=74 passenv = DOCKER_* @@ -261,7 +261,7 @@ passenv = DOCKER_* commands = {[base]pip_install} . {[base]pip_install} certbot-ci - pytest --pyargs certbot_integration_tests.certbot_tests \ + pytest certbot-ci/certbot_integration_tests/certbot_tests \ --acme-server={env:ACME_SERVER:pebble} passenv = DOCKER_* setenv = {[testenv:py27-oldest]setenv} @@ -270,7 +270,7 @@ setenv = {[testenv:py27-oldest]setenv} commands = {[base]pip_install} certbot-nginx {[base]pip_install} certbot-ci - pytest --pyargs certbot_integration_tests.nginx_tests \ + pytest certbot-ci/certbot_integration_tests/nginx_tests \ --acme-server={env:ACME_SERVER:pebble} passenv = DOCKER_* setenv = {[testenv:py27-oldest]setenv}