@@ -6,34 +6,17 @@ printf "\n%100s\n\n" | tr ' ' '*'
66
77# Get the directory of the script
88SCRIPT_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " & > /dev/null && pwd ) "
9- VENV_DIR=" $SCRIPT_DIR /.venv"
10- REQS_TXT=" $SCRIPT_DIR /requirements.txt"
11- PYPROJECT=" $SCRIPT_DIR /pyproject.toml"
129
13- # If a virtual environment is already active, use it
14- if [ -n " $VIRTUAL_ENV " ]; then
15- echo " Using already active Python environment: $VIRTUAL_ENV "
16- # Otherwise, try to activate the local venv if it exists
17- elif [ -d " $VENV_DIR " ]; then
18- echo " Activating Python environment from $VENV_DIR "
19- source " $VENV_DIR /bin/activate"
20- # If no environment is active and no venv exists, create a new venv
21- else
22- echo " No active Python environment found. Creating venv at $VENV_DIR ."
23- python3 -m venv " $VENV_DIR "
24- source " $VENV_DIR /bin/activate"
25- # Install dependencies if requirements.txt or pyproject.toml is present
26- if [ -f " $REQS_TXT " ]; then
27- echo " Installing dependencies from requirements.txt..."
28- pip install -r " $REQS_TXT "
29- elif [ -f " $PYPROJECT " ]; then
30- echo " Installing dependencies from pyproject.toml..."
31- pip install .[test]
32- else
33- echo " No requirements.txt or pyproject.toml found. Skipping dependency install."
34- fi
10+ # Check if a virtual environment is active
11+ if [ -z " $VIRTUAL_ENV " ]; then
12+ echo " ❌ Error: No Python virtual environment is active"
13+ echo " Please activate the swf-testbed virtual environment first:"
14+ echo " cd swf-testbed && source .venv/bin/activate"
15+ exit 1
3516fi
3617
18+ echo " Using Python environment: $VIRTUAL_ENV "
19+
3720# Run tests if the tests directory exists and is not empty
3821if [ -d " $SCRIPT_DIR /tests" ] && [ " $( ls -A " $SCRIPT_DIR /tests" 2> /dev/null) " ]; then
3922 echo " Running pytest for swf-testbed..."
0 commit comments