-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathrun_test copy.sh.save
More file actions
executable file
·49 lines (38 loc) · 1.08 KB
/
run_test copy.sh.save
File metadata and controls
executable file
·49 lines (38 loc) · 1.08 KB
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
43
44
45
46
47
48
49
#!/bin/bash
set -e
PYTHON_VERSION="$1"
DESCRIPTION="$2"
COVERAGE_XML="sonarcloud-coverage-$3.xml"
# show cwd
echo "Current working directory: $(pwd)"
# list contents of venv
ls -la .
########### debug
echo "Which Python:"
which python$PYTHON_VERSION || echo "python$PYTHON_VERSION not found in PATH"
echo "Available interpreters:"
pyenv versions || true
echo "Using Python Version $PYTHON_VERSION"
poetry config virtualenvs.in-project true
##############
# Only create/use the env and install if .venv does not exist
echo "Checking for Poetry virtual environment (.venv)"
poetry env list
if [ ! -d ".venv" ]; then
echo "Creating virtual environment (.venv) with Poetry"
poetry env use "$PYTHON_VERSION"
########### debug
echo "Poetry environment info:"
poetry env info || true
###########
poetry install
poetry env list
else
echo "Using cached virtual environment (.venv)"
fi
if poetry run coverage run -m unittest discover; then
echo "$DESCRIPTION tests passed"
else
echo "$DESCRIPTION tests failed" >> ../failed_tests.txt
fi
poetry run coverage xml -o "../$COVERAGE_XML"