certbot/tests/letstest/scripts/test_sdists.sh
Adrien Ferrand 55d411f1eb
Remove deprecated python setup.py test call and update packager guide (#8262)
Fixes #7585

This PR removes the specific configuration to configure the test runner included in `setuptools` to use pytest, the deprecated parameters related to setuptools testing in `setup.py`, and update the packaging guide to use `python -m pytest` instead of `python setup.py test`.

The farm test `test_sdist.sh` is also updated to use directly pytest. This test is designed to reproduce the steps used by OS integrators when they package `certbot`, and ensure that we are not breaking something that will impact their work. We discussed with integrators from RHEL/CentOS and Debian, and they are fine with us testing sdist directly with pytest.

One execution of the `test_sdist.sh` farm test with the modifications made by this PR can be seen here: https://dev.azure.com/certbot/certbot/_build/results?buildId=2606&view=results

* Remove setuptools deprecated features about testing

* Updating packaging guide

* Add changelog entry
2020-09-10 15:57:59 -07:00

46 lines
1.2 KiB
Bash
Executable file

#!/bin/sh -xe
cd letsencrypt
BOOTSTRAP_SCRIPT="tests/letstest/scripts/bootstrap_os_packages.sh"
VENV_PATH=venv3
# install OS packages
sudo $BOOTSTRAP_SCRIPT
if command -v python && [ $(python -V 2>&1 | cut -d" " -f 2 | cut -d. -f1,2 | sed 's/\.//') -eq 26 ]; then
# RHEL/CentOS 6 will need a special treatment, so we need to detect that environment
# Enable the SCL Python 3.6 installed by letsencrypt-auto bootstrap
PATH="/opt/rh/rh-python36/root/usr/bin:$PATH"
fi
# setup venv
CERTBOT_PIP_NO_BINARY=:all: tools/venv3.py --requirement letsencrypt-auto-source/pieces/dependency-requirements.txt
. "$VENV_PATH/bin/activate"
# pytest is needed to run tests on some of our packages so we install a pinned version here.
tools/pip_install.py pytest
PLUGINS="certbot-apache certbot-nginx"
TEMP_DIR=$(mktemp -d)
# build sdists
for pkg_dir in acme certbot $PLUGINS; do
cd $pkg_dir
python setup.py clean
rm -rf build dist
python setup.py sdist
mv dist/* $TEMP_DIR
cd -
done
VERSION=$(python letsencrypt-auto-source/version.py)
# test sdists
cd $TEMP_DIR
for pkg in acme certbot $PLUGINS; do
tar -xvf "$pkg-$VERSION.tar.gz"
cd "$pkg-$VERSION"
python setup.py build
python -m pytest
python setup.py install
cd -
done