python-mylib/tests.sh

29 lines
506 B
Bash
Raw Normal View History

#!/bin/bash
# Enter source directory
cd $( dirname $0 )
if [ -d venv ]
then
VENV=$( realpath venv )
TEMP_VENV=0
else
# Install stdeb in temporary venv
VENV=$(mktemp -d)
echo "Create a temporary virtualenv in $VENV to install build dependencies..."
TEMP_VENV=1
python3 -m venv $VENV
fi
# Install package with dev dependencies
$VENV/bin/python3 -m pip install -e ".[dev]"
# Run tests
$VENV/bin/python3 -m pytest tests
RES=$?
# Clean temporary venv
[ $TEMP_VENV -eq 1 ] && rm -fr $VENV
exit $RES