Skip to content

Commit f48385e

Browse files
committed
Add virtualenv activation to tests
1 parent 42275a7 commit f48385e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

script/run_tests

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Runs pep8, pylint, and unittests
33
BASE_DIR="$( cd "$(dirname "$0")/.." ; pwd -P )"
44
SRC_DIR="${BASE_DIR}/src"
5+
ENV_DIR=".venv"
56
PACKAGES="codejam"
67
STATUS=0
78

@@ -13,6 +14,18 @@ exit_msg() {
1314
fi
1415
}
1516

17+
# Activate the virtualenv if one isn't active
18+
if [ -z "$VIRTUAL_ENV" ]; then
19+
if [ -d "${BASE_DIR}/.venv" ]; then
20+
echo -n "Activating the virtual environment... "
21+
source "${BASE_DIR}/.venv/bin/activate"
22+
echo "done"
23+
else
24+
echo "No virtualenv to activate!"
25+
exit 1
26+
fi
27+
fi
28+
1629
# test if pep8 exists
1730
if ! hash pep8 2>/dev/null; then
1831
echo "pep8 is not on the path!"

0 commit comments

Comments
 (0)