mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-06 11:23:48 -05:00
In the past we've avoided using out-of-the-box solutions for Python dependency resolution because a) they haven't been very mature and b) we've had lots of issues with version conflicts. See [[1]], [[2]] for details. Instead, we've been using a custom Python script that under-the-hood runs `pip freeze` and saves the output to `requirements.txt`. This script works well for us, but it doesn't integrate well with other tools. On the other hand [`pip-tools`](https://github.com/jazzband/pip-tools) as of 2020 seems to be well-supported by its maintainers and other tools; for instance, GitHub's automated update service [Dependabot](https://dependabot.com) supports `requirements.in` files. This commit replaces our `freeze-requirements` make command with `pip-compile`. The Digital Marketplace team have made this change and seem happy with the results.
38 lines
699 B
Bash
Executable File
38 lines
699 B
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Run project tests
|
|
#
|
|
# NOTE: This script expects to be run from the project root with
|
|
# ./scripts/run_tests.sh
|
|
|
|
set -o pipefail
|
|
|
|
function display_result {
|
|
RESULT=$1
|
|
EXIT_STATUS=$2
|
|
TEST=$3
|
|
|
|
if [ $RESULT -ne 0 ]; then
|
|
echo -e "\033[31m$TEST failed\033[0m"
|
|
exit $EXIT_STATUS
|
|
else
|
|
echo -e "\033[32m$TEST passed\033[0m"
|
|
fi
|
|
}
|
|
|
|
if [[ -z "$VIRTUAL_ENV" ]] && [[ -d venv ]]; then
|
|
source ./venv/bin/activate
|
|
fi
|
|
|
|
flake8 .
|
|
display_result $? 1 "Code style check"
|
|
|
|
isort --check-only -rc ./app ./tests
|
|
display_result $? 2 "Import order check"
|
|
|
|
npm test
|
|
display_result $? 3 "Javascript tests have"
|
|
|
|
py.test -n auto --maxfail=10 tests/
|
|
display_result $? 4 "Unit tests have"
|