From c515c564543a89401f193f4fb0d151f65c69d0f8 Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Wed, 29 Jul 2020 22:44:18 +0300 Subject: [PATCH] Use `python3` command if virtualenv doesn't exist --- tests/run-tests.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/run-tests.sh b/tests/run-tests.sh index 36461f5..97354ce 100644 --- a/tests/run-tests.sh +++ b/tests/run-tests.sh @@ -13,7 +13,14 @@ # work from script's dir cd "$(dirname "$0")" || exit +# detect Python - if not set in env, try default virtualenv PYTHON="${PYTHON:-../ve/bin/python}" +# if no virtalenv, try current python3 binary +if ! command -v $PYTHON &> /dev/null; then + PYTHON=$(command -v python3) +fi +echo "Using PYTHON: $PYTHON" + "$PYTHON" --version 2>&1 | grep -q 'Python 2' && python_version=2 || python_version=3 skip_online="${CHEATSH_TEST_SKIP_ONLINE:-NO}"