Files
pipenv/run-tests.sh
T
Matt Davis 9848862927 Convert test runner to use pypiserver package as standalone process (#5284)
* Check point progress on moving tests to pypiserver.

* Allow other indexes to mimic the pypi json API for package hashes.

* Fix these tests that run on lower python versions only.

* Try adding the pypiserver to the github actions to only run once.

* Expand the scope of fixtures for pypiserver.

* try to accomedate microsoft runner.

* Windows networking troubles.

* Remove running as a background job.

* Try to condtionally invoke different start pypi-server commands

* Try to condtionally invoke different start pypi-server commands

* Try to condtionally invoke different start pypi-server commands

* Try to condtionally invoke different start pypi-server commands

* Try to condtionally invoke different start pypi-server commands

* Try to condtionally invoke different start pypi-server commands

* Try to condtionally invoke different start pypi-server commands

* Try to introduce pypi as the root index because setuptools-scm is not in our pypi artifacts.

* see if the windows tests run faster (and the other tests) by supplying waitress.

* Only use waitress on windows because the others are fast on the default.  Fix requests pollution.

* Supply a suitable Pipfile instead for these two failing tests.

* More requests resolver cross test contamination cleanup.

* remove problematic tests because even on my version of python 3.8.12 this does not work due to AttributeError: 'HTMLParser' object has no attribute 'unescape'

* fix mirror install test.

* Fix Pipfile.

* Fix Pipfile for real

* Fix tests

* Cleanup test naming and more test enhancements.

* Save this optimization for a subsequent PR.

* Cleanup the TemporaryDirectory between tests.

* resolve merge conflict.

* Cleanup path initalization -- it hsould always be a TemporaryDirectory for tests that gets cleanedup.

* Cleanup path initalization -- it hsould always be a TemporaryDirectory for tests that gets cleanedup.

* tableflip on those requests tests that read the setup metadata in reqlib from other tests.

* Update developer documentation for running tests.

* add news fragment.

* Try gunicorn perfoormance for linux/mac

* Only use gunicorn on linux based on the results of last run.
2022-09-05 10:19:12 -04:00

61 lines
1.8 KiB
Bash
Executable File

#!/usr/bin/env bash
# Tested on debian and alpine
# You will need to install some dependencies yourself.
set -eo pipefail
export PYTHONIOENCODING="utf-8"
export LANG=C.UTF-8
# Let's use a temporary cache directory
export PIPENV_CACHE_DIR=`mktemp -d 2>/dev/null || mktemp -d -t 'pipenv_cache'`
# on some Linux OS python is python3
PYTHON=${PYTHON:-"python"}
PIPENV_PYTHON="${PIPENV_PYTHON:-3.7}"
PIP_CALL="${PIP_CALL:-${PYTHON} -m pip install --user}"
HOME=$(readlink -f ~/)
if [[ -z "$HOME" ]]; then
if [[ "$USER" == "root" ]]; then
HOME="/root"
fi
fi
if [[ ! -z "$HOME" ]]; then
export PATH="${HOME}/.local/bin:${PATH}"
fi
# This installs the dependencies for pipenv
${PIP_CALL} --upgrade pip setuptools wheel virtualenv --upgrade-strategy=eager
VENV_CMD="${PYTHON} -m pipenv --venv"
RM_CMD="pipenv --rm"
echo "$ PIPENV_PYTHON=${PIPENV_PYTHON} $VENV_CMD && PIPENV_PYTHON=${PIPENV_PYTHON} $RM_CMD"
{ PIPENV_PYTHON="${PIPENV_PYTHON}" $VENV_CMD && PIPENV_PYTHON=${PIPENV_PYTHON} $RM_CMD ; }
echo "Installing dependencies..."
INSTALL_CMD="${PYTHON} -m pipenv install --deploy --dev"
echo "$ PIPENV_PYTHON=${PIPENV_PYTHON} $INSTALL_CMD"
PIPENV_PYTHON=${PIPENV_PYTHON} $INSTALL_CMD
echo "$ git submodule sync && git submodule update --init --recursive"
git submodule sync && git submodule update --init --recursive
echo "pipenv run pypi-server run -v --host=0.0.0.0 --port=8080 --hash-algo=sha256 --disable-fallback ./tests/pypi/ ./tests/fixtures &"
pipenv run pypi-server run -v --host=0.0.0.0 --port=8080 --hash-algo=sha256 --disable-fallback ./tests/pypi/ ./tests/fixtures &
echo "$pipenv run pytest -v -ra -n auto --cov-config setup.cfg --fulltrace tests"
PIPENV_PYTHON=${PIPENV_PYTHON} ${PYTHON} -m pipenv run pytest -v -ra -n auto --cov-config setup.cfg --fulltrace tests