python-mylib/tests.sh
Benjamin Renard a0e7aae504
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Add tests.sh script and use it for CI step to fix sh shell problems
2022-04-27 18:02:54 +02:00

28 lines
506 B
Bash
Executable file

#!/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