2018-06-25 13:15:32 +00:00
|
|
|
#!/bin/sh -e
|
|
|
|
|
|
|
|
export PREFIX=""
|
|
|
|
if [ -d 'venv' ] ; then
|
|
|
|
export PREFIX="venv/bin/"
|
|
|
|
fi
|
|
|
|
|
2018-10-09 11:27:27 +00:00
|
|
|
export VERSION_SCRIPT="import sys; print('%s.%s' % sys.version_info[0:2])"
|
|
|
|
export PYTHON_VERSION=`python -c "$VERSION_SCRIPT"`
|
|
|
|
|
2018-12-04 16:05:16 +00:00
|
|
|
if [ -z "$STARLETTE_TEST_DATABASE" ] ; then
|
|
|
|
echo "Variable STARLETTE_TEST_DATABASE is unset. Excluding database tests."
|
2019-01-14 12:39:40 +00:00
|
|
|
export IGNORE_MODULES="--ignore tests/test_database.py --cov-config tests/.ignore_database_tests"
|
2018-12-04 16:05:16 +00:00
|
|
|
else
|
|
|
|
echo "Variable STARLETTE_TEST_DATABASE is set"
|
|
|
|
export IGNORE_MODULES=""
|
|
|
|
fi
|
|
|
|
|
2018-06-25 13:15:32 +00:00
|
|
|
set -x
|
|
|
|
|
2018-12-04 16:05:16 +00:00
|
|
|
PYTHONPATH=. ${PREFIX}pytest --ignore venv ${IGNORE_MODULES} -W ignore::DeprecationWarning --cov=starlette --cov=tests --cov-fail-under=100 --cov-report=term-missing ${@}
|
2018-10-16 14:56:28 +00:00
|
|
|
${PREFIX}mypy starlette --ignore-missing-imports --disallow-untyped-defs
|
2019-01-14 12:39:40 +00:00
|
|
|
${PREFIX}autoflake --recursive starlette tests
|
2018-10-09 11:27:27 +00:00
|
|
|
if [ "${PYTHON_VERSION}" = '3.7' ]; then
|
|
|
|
echo "Skipping 'black' on 3.7. See issue https://github.com/ambv/black/issues/494"
|
|
|
|
else
|
|
|
|
${PREFIX}black starlette tests --check
|
|
|
|
fi
|
2018-10-29 14:46:42 +00:00
|
|
|
${PREFIX}isort --multi-line=3 --trailing-comma --force-grid-wrap=0 --combine-as --line-width 88 --recursive --check-only starlette tests
|