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
|
|
|
|
2023-01-06 22:18:46 +01:00
|
|
|
RES=0
|
2022-04-27 18:02:54 +02:00
|
|
|
# Run tests
|
|
|
|
$VENV/bin/python3 -m pytest tests
|
2023-01-06 22:18:46 +01:00
|
|
|
[ $? -ne 0 ] && RES=1
|
|
|
|
|
|
|
|
# Run pylint
|
|
|
|
echo "Run pylint..."
|
|
|
|
$VENV/bin/pylint --extension-pkg-whitelist=cx_Oracle mylib tests
|
|
|
|
[ $? -ne 0 ] && RES=1
|
|
|
|
|
|
|
|
# Run flake8
|
|
|
|
echo "Run flake8..."
|
|
|
|
$VENV/bin/flake8 mylib tests
|
|
|
|
[ $? -ne 0 ] && RES=1
|
2022-04-27 18:02:54 +02:00
|
|
|
|
|
|
|
# Clean temporary venv
|
|
|
|
[ $TEMP_VENV -eq 1 ] && rm -fr $VENV
|
|
|
|
|
|
|
|
exit $RES
|