# SPDX-License-Identifier: LGPL-2.1-only # Copyright 2022 Jookia <contact@jookia.org> activate() { . venv/bin/activate; } die() { rm -r venv echo "$1" exit 1 } setup() { echo "No venv found, creating..." python3 -m venv venv || die "Unable to create venv" echo "Activating venv..." activate echo "Updating pip..." pip -q install -U pip || die "Unable to update pip" echo "Installing requirements..." pip -q install -r requirements.txt || die "Unable to install requirements" touch venv/.stamp echo "All done!" } if test -e venv/.stamp; then activate; else setup; fi unset -f activate die setup dotidy() { black src tests build.py; } dolint() { flake8 src tests build.py; } dotest() { pytest -q -n auto -x -l --sw --hypothesis-profile=dev $@; } dotest_dev() { pytest -vv -n 0 -x -l --sw --hypothesis-profile=dev $@; } dotest_ci() { pytest -q -n auto --hypothesis-profile=ci; } dotest_long() { pytest -q -n auto --hypothesis-profile=long; } docheck() { dotidy && dolint && dotest; } _envsh_domut() { mutmut run --paths-to-mutate "src/token.py,src/tokenize.py,src/parse.py" $@; } domut() { _envsh_domut; } domut_ci() { _envsh_domut --no-progress || (mutmut results; exit 1); } dobuild() { python build.py; }