2022-04-27 18:02:54 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2022-04-27 18:56:03 +02:00
|
|
|
QUIET_ARG=""
|
|
|
|
[ "$1" == "--quiet" ] && QUIET_ARG="--quiet"
|
|
|
|
|
2022-04-27 18:02:54 +02:00
|
|
|
# Enter source directory
|
|
|
|
cd $( dirname $0 )
|
|
|
|
|
|
|
|
if [ -d venv ]
|
|
|
|
then
|
|
|
|
VENV=$( realpath venv )
|
|
|
|
TEMP_VENV=0
|
|
|
|
else
|
2022-04-27 18:56:03 +02:00
|
|
|
# Create a temporary venv
|
2022-04-27 18:02:54 +02:00
|
|
|
VENV=$(mktemp -d)
|
2022-04-27 18:56:03 +02:00
|
|
|
echo "Create a temporary virtualenv in $VENV to install dependencies..."
|
2022-04-27 18:02:54 +02:00
|
|
|
TEMP_VENV=1
|
|
|
|
python3 -m venv $VENV
|
|
|
|
fi
|
|
|
|
|
2022-04-27 18:56:03 +02:00
|
|
|
echo "Install package with dev dependencies using pip..."
|
|
|
|
$VENV/bin/python3 -m pip install -e ".[dev]" $QUIET_ARG
|
2022-04-27 18:02:54 +02:00
|
|
|
|
|
|
|
# Run tests
|
|
|
|
$VENV/bin/python3 -m pytest tests
|
|
|
|
RES=$?
|
|
|
|
|
|
|
|
# Clean temporary venv
|
|
|
|
[ $TEMP_VENV -eq 1 ] && rm -fr $VENV
|
|
|
|
|
|
|
|
exit $RES
|