1
0
mirror of https://github.com/certbot/certbot.git synced 2026-01-26 07:41:33 +03:00
Files
certbot/letstest/scripts/test_sdists.sh
Brad Warren dd0e590de3 Make a test farm tests package (#8821)
Fixes https://github.com/certbot/certbot/issues/8781.

This PR makes our test farm tests into a normal package so it and its dependencies can be tracked and installed like our other packages.

Other noteworthy changes in this PR:

* Rather than continuing to place logs in your CWD, they're placed in a temporary directory that is printed to the terminal.
*  `tests/letstest/auto_targets.yaml` was deleted rather than renamed because the file is no longer used.

* make a letstest package

* remove deleted deps

* fix letstest install

* add __init__.py

* call main

* Explicitly mention activating venv

* rerename file

* fix version.py path

* clarify "this"

* Use >= instead of caret requirement
2021-05-03 17:42:30 -07:00

54 lines
1.6 KiB
Bash
Executable File

#!/bin/sh -xe
cd letsencrypt
BOOTSTRAP_SCRIPT="letstest/scripts/bootstrap_os_packages.sh"
VENV_PATH=venv
# install OS packages
. $BOOTSTRAP_SCRIPT
# setup venv
python3 -m venv $VENV_PATH
$VENV_PATH/bin/python3 tools/pipstrap.py
. "$VENV_PATH/bin/activate"
# pytest is needed to run tests on our packages so we install a pinned version here.
tools/pip_install.py pytest
# setup constraints
TEMP_DIR=$(mktemp -d)
CONSTRAINTS="$TEMP_DIR/constraints.txt"
cp tools/requirements.txt "$CONSTRAINTS"
# We pin cryptography to 3.1.1 and pyopenssl to 19.1.0 specifically for CentOS 7 / RHEL 7
# because these systems ship only with OpenSSL 1.0.2, and this OpenSSL version support has been
# dropped on cryptography>=3.2 and pyopenssl>=20.0.0.
# Using this old version of OpenSSL would break the cryptography and pyopenssl wheels builds.
if [ -f /etc/redhat-release ] && [ "$(. /etc/os-release 2> /dev/null && echo "$VERSION_ID" | cut -d '.' -f1)" -eq 7 ]; then
sed -i 's|cryptography==.*|cryptography==3.1.1|g' "$CONSTRAINTS"
sed -i 's|pyopenssl==.*|pyopenssl==19.1.0|g' "$CONSTRAINTS"
fi
PLUGINS="certbot-apache certbot-nginx"
# 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 letstest/scripts/version.py)
# test sdists
cd $TEMP_DIR
for pkg in acme certbot $PLUGINS; do
tar -xvf "$pkg-$VERSION.tar.gz"
cd "$pkg-$VERSION"
PIP_CONSTRAINT=../constraints.txt PIP_NO_BINARY=:all: pip install .
python -m pytest
cd -
done