1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
#!/bin/sh
export PYTHONPATH=".:$PYTHONPATH"
export DJANGO_SETTINGS_MODULE="test_settings"
PROG="$0"
CMD="$1"
shift
usage() {
echo "USAGE: $PROG [command]"
echo " test - run the ratelimit tests"
echo " lint - run flake8 (alias: flake8)"
echo " shell - open the Django shell"
echo " build - build a package for release"
echo " check - run twine check on build artifacts"
exit 1
}
case "$CMD" in
"test" )
echo "Django version: $(python -m django --version)"
python \
-W error::ResourceWarning \
-W error::DeprecationWarning \
-W error::PendingDeprecationWarning \
-m django \
test \
django_ratelimit \
"$@"
;;
"lint"|"flake8" )
echo "Flake8 version: $(flake8 --version)"
flake8 "$@" django_ratelimit/
;;
"shell" )
python -m django shell
;;
"build" )
rm -rf dist/*
python -m build
;;
"check" )
twine check dist/*
;;
* )
usage ;;
esac
|