-
Notifications
You must be signed in to change notification settings - Fork 248
Expand file tree
/
Copy pathbehave.sh
More file actions
executable file
·42 lines (34 loc) · 877 Bytes
/
behave.sh
File metadata and controls
executable file
·42 lines (34 loc) · 877 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env bash
set -euo pipefail
basedir=$(dirname "$0")
reinit_flag="$basedir/reinit"
PATH+=:~/.local/bin
# Try to find a valid python3 interpreter
if command -v python3 >/dev/null; then
PYTHON=$(command -v python3)
elif command -v python >/dev/null; then
PYTHON=$(command -v python)
else
echo "Error: Python 3 not found"
exit 1
fi
# Ensure pipenv is installed
if ! command -v pipenv >/dev/null; then
echo "Installing pipenv"
"$PYTHON" -m pip install --user pipenv
fi
cd "$basedir"
# Reinitialize environment if requested
if [ -f "$reinit_flag" ]; then
echo "Reinitializing"
pipenv --rm || true
rm "$reinit_flag"
fi
# Create environment with the detected Python interpreter
if ! pipenv --venv >/dev/null 2>&1; then
echo "Creating pipenv with $PYTHON"
pipenv --python "$PYTHON"
pipenv sync
fi
# Run behave tests
exec pipenv run behave "$@"